@arcgis/core 4.33.0-next.20250326 → 4.33.0-next.20250327
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/applications/Components/viewUtils.d.ts +3 -0
- package/applications/Components/viewUtils.js +5 -0
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/feature.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geometry.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/functions/maths.js +1 -1
- package/arcade/functions/stats.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/geometry/functions.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0f37b3a797d8a55439a4.js +1 -0
- package/assets/esri/core/workers/chunks/{6ff981ec0c725efe5525.js → 470cf066294b053c2732.js} +1 -1
- package/assets/esri/core/workers/chunks/{ba47e43ef039fe4b8c5c.js → 605eddec7aac891ed141.js} +1 -1
- package/assets/esri/core/workers/chunks/75a04b073231da70c18d.js +1 -0
- package/assets/esri/core/workers/chunks/{fa3eeb40e2d732c184d8.js → 7f8c7e3e41e51ab4d612.js} +1 -1
- package/assets/esri/core/workers/chunks/80aaf31c8eec3cff2add.js +1 -0
- package/assets/esri/core/workers/chunks/82692bff98b4ec781544.js +319 -0
- package/assets/esri/core/workers/chunks/86ee278919038260696e.js +39 -0
- package/assets/esri/core/workers/chunks/{4496ef270c700078df0c.js → 8752f807c05d1ec215e8.js} +1 -1
- package/assets/esri/core/workers/chunks/9c59fc2df8081e65a128.js +1 -0
- package/assets/esri/core/workers/chunks/{d5d2a4e8e19898d86c6d.js → a2377969f76640f1d6fe.js} +1 -1
- package/assets/esri/core/workers/chunks/{e0ac90b4ad8c36fb7d70.js → b2666b89755323a84fcb.js} +1 -1
- package/assets/esri/core/workers/chunks/{726e3f413824f02fe689.js → bd2dcc55ac3418421ee5.js} +1 -1
- package/assets/esri/core/workers/chunks/{b8a4352f83502449ff95.js → cbbbaccc0d3683e1c0fe.js} +1 -1
- package/assets/esri/core/workers/chunks/{e4290719c8afc2a4ee8c.js → cc441051a52bfbda9caf.js} +1 -1
- package/assets/esri/core/workers/chunks/d3912886ac2910290f43.js +1 -0
- package/assets/esri/core/workers/chunks/e08bff9f8247909776a4.js +1 -0
- package/assets/esri/core/workers/chunks/{042771b4e56355924140.js → e9993d4f2bfdc434fbcc.js} +1 -1
- package/assets/esri/core/workers/chunks/{4dc1e7d7ac2a4b0144c4.js → f128d3431da86e484117.js} +28 -29
- package/chunks/ComponentShader.glsl.js +25 -25
- package/chunks/HUDMaterial.glsl.js +2 -2
- package/chunks/LineMarker.glsl.js +26 -26
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/RibbonLine.glsl.js +35 -33
- package/chunks/Terrain.glsl.js +33 -33
- package/chunks/aiServices.js +1 -1
- package/chunks/array.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/geometry/operators/projectOperator.js +1 -1
- package/geometry/operators/shapePreservingProjectOperator.js +1 -1
- package/interfaces.d.ts +246 -7
- package/layers/LinkChartLayer.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/layers/TileLayer.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/support/util.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
- package/views/3d/layers/DrapedSubView3D.js +1 -1
- package/views/3d/layers/GraphicsView3D.js +1 -1
- package/views/3d/layers/ImageryLayerView3D.js +1 -1
- package/views/3d/layers/MapImageLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/TileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/ImageHighlightHelper3D.js +5 -0
- package/views/3d/layers/support/SublayerPopupHighlightHelper3D.js +5 -0
- package/views/3d/terrain/Overlay.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/RasterTile.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +9 -10
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlightOverlay.js +11 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +3 -6
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/NativeLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/PointRendererTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/VideoView.d.ts +4 -0
- package/views/VideoView.js +1 -1
- package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
- package/views/layers/support/highlightUtils.js +5 -0
- package/views/support/TextureCompressionHandle.js +5 -0
- package/views/webgl/ShaderBuilder.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/TextureDescriptor.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0059295780fa4a090f30.js +0 -319
- package/assets/esri/core/workers/chunks/3fc18638f8799b85001d.js +0 -1
- package/assets/esri/core/workers/chunks/81bf362ec0d23ffdc90c.js +0 -39
- package/assets/esri/core/workers/chunks/a59ad50d932da1e28c8f.js +0 -1
- package/assets/esri/core/workers/chunks/afe94e351b4a50d7bc53.js +0 -1
- package/assets/esri/core/workers/chunks/b8416f2560710258c239.js +0 -1
- package/assets/esri/core/workers/chunks/e088edb9ffbaa1ed12eb.js +0 -1
- package/assets/esri/core/workers/chunks/f454e773505c0eef2f9d.js +0 -1
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{earth as e,mars as o,moon as r}from"../geometry/support/Ellipsoid.js";import{OverlayContent as a}from"../views/3d/terrain/OverlayContent.js";import{
|
|
5
|
+
import{earth as e,mars as o,moon as r}from"../geometry/support/Ellipsoid.js";import{OverlayContent as a}from"../views/3d/terrain/OverlayContent.js";import{ComponentData as i,ComponentDataType as l}from"../views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js";import{VertexDiscardMode as t}from"../views/3d/webgl-engine/collections/Component/Material/shader/VertexDiscardMode.js";import{ForwardLinearDepth as n}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js";import{ShaderOutput as d,isColorOrColorEmission as s}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SlicePass as g}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{TextureCoordinateAttribute as m}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexColor as c}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js";import{VertexNormal as v}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js";import{VertexPosition as u}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js";import{OutputDepth as h}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js";import{OutputHighlight as w}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{OutputHighlightOverlay as p}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlightOverlay.js";import{computeFragmentNormals as b}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import{ComputeMaterialColor as C}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import{ComputeNormalTexture as f}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import{EvaluateSceneLighting as y,addLightingGlobalFactor as x}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{addMainLightIntensity as L}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{PBRMode as j,PhysicallyBasedRenderingParameters as O}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{ReadBaseColorTexture as S}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import{ReadShadowMapPass as N}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{terrainDepthTest as T}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{OverlayIM as M,getIMColorTexture as $}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{DiscardOrAdjustAlphaDraw as A}from"../views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import{EllipsoidMode as D}from"../views/3d/webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{If as W,glsl as P}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DBindUniform as B}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as R}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{outputColorHighlightOID as z}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js";import{ShaderBuilder as E}from"../views/webgl/ShaderBuilder.js";import{alphaCutoff as I}from"../webscene/support/AlphaCutoff.js";function V(V){const F=new E,{vertex:H,fragment:_}=F;F.include(u,V),F.include(v,V),F.include(c,V),F.include(m,V),F.include(n,V),F.include(i,V),F.include(A,V),_.include(g,V),F.include(S,V),F.include(T,V);const{output:G,pbrMode:k,hasNormalTexture:U,snowCover:q,receiveShadows:J,spherical:K,ellipsoidMode:Q,overlayEnabled:X,componentData:Y,vertexDiscardMode:Z}=V,ee=k===j.Normal||k===j.Schematic;ee&&(F.include(O,V),U&&F.include(f,V));const oe=G===d.Shadow||G===d.ShadowHighlight||G===d.ShadowExcludeHighlight,re=oe&&Y===l.Varying;if(X){F.include(y,V),F.include(M,V);const a=Q===D.Earth,i=Q===D.Earth,l=a?e.radius:i?o.radius:r.radius;H.code.add(`\n ${W(K,`const float invRadius = ${P.float(1/l)};`)}\n vec2 projectOverlay(vec3 pos) { return pos.xy ${W(K,"/ (1.0 + invRadius * pos.z);")}; }`)}const ae=X&&s(G)&&k===j.WaterOnIntegratedMesh;ae&&(F.varyings.add("tbnTangent","vec3"),F.varyings.add("tbnBiTangent","vec3"),F.varyings.add("groundNormal","vec3"));const ie=Z===t.None,le=Z===t.Opaque,te=1-1/255;if(H.main.add(P`
|
|
6
6
|
bool castShadows;
|
|
7
7
|
vec4 externalColor = forwardExternalColor(castShadows);
|
|
8
|
-
${
|
|
8
|
+
${W(re,"if(!castShadows) { gl_Position = vec4(vec3(1e38), 1.0); return; }")}
|
|
9
9
|
|
|
10
|
-
${
|
|
10
|
+
${W(!ie,`{ if (externalColor.a ${le?">":"<="} ${P.float(te)}) { gl_Position = vec4(vec3(1e38), 1.0); return; } }`)}
|
|
11
11
|
|
|
12
|
-
${
|
|
12
|
+
${W(G===d.ObjectAndLayerIdColor,"externalColor.a = 1.0;")}
|
|
13
13
|
|
|
14
14
|
forwardPosition(readElevationOffset());
|
|
15
15
|
forwardViewPosDepth(vPosition_view);
|
|
@@ -18,24 +18,24 @@ import{earth as e,mars as o,moon as r}from"../geometry/support/Ellipsoid.js";imp
|
|
|
18
18
|
forwardVertexColor();
|
|
19
19
|
forwardLinearDepth();
|
|
20
20
|
forwardObjectAndLayerIdColor();
|
|
21
|
-
${
|
|
21
|
+
${W(ae,K?P`
|
|
22
22
|
groundNormal = normalize(positionWorld());
|
|
23
23
|
tbnTangent = normalize(cross(vec3(0.0, 0.0, 1.0), groundNormal));
|
|
24
24
|
tbnBiTangent = normalize(cross(groundNormal, tbnTangent));`:P`
|
|
25
25
|
groundNormal = vec3(0.0, 0.0, 1.0);
|
|
26
26
|
tbnTangent = vec3(1.0, 0.0, 0.0);
|
|
27
27
|
tbnBiTangent = vec3(0.0, 1.0, 0.0);`)}
|
|
28
|
-
${
|
|
28
|
+
${W(X,"setOverlayVTC(projectOverlay(position));")}
|
|
29
29
|
|
|
30
30
|
if (externalColor.a < ${P.float(I)}) {
|
|
31
31
|
// Discard this vertex
|
|
32
32
|
gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
`),
|
|
35
|
+
`),s(G))return F.include(C,V),F.include(b,V),F.include(y,V),F.include(z,V),J&&F.include(N,V),_.code.add(P`
|
|
36
36
|
float evaluateShadow() {
|
|
37
37
|
return ${J?"readShadowMap(vPositionWorldCameraRelative, linearDepth)":"0.0"};
|
|
38
|
-
}`),
|
|
38
|
+
}`),X&&_.uniforms.add(new R("ovColorTex",((e,o)=>$(e,o)))),_.main.add(P`
|
|
39
39
|
discardBySlice(vPositionWorldCameraRelative);
|
|
40
40
|
discardByTerrainDepth();
|
|
41
41
|
|
|
@@ -47,45 +47,45 @@ import{earth as e,mars as o,moon as r}from"../geometry/support/Ellipsoid.js";imp
|
|
|
47
47
|
readExternalColor(externalColor, externalColorMixMode);
|
|
48
48
|
|
|
49
49
|
vec4 materialColor = computeMaterialColor(textureColor, externalColor, externalColorMixMode);
|
|
50
|
-
${
|
|
51
|
-
`),
|
|
50
|
+
${W(X,P`vec4 overlayColor = getOverlayColor(ovColorTex, vtcOverlay);`)}
|
|
51
|
+
`),ee?(L(_),K&&x(_),_.main.add(P`
|
|
52
52
|
applyPBRFactors();
|
|
53
|
-
${
|
|
53
|
+
${W(k===j.Normal,P`if (externalColorMixMode == 3) {
|
|
54
54
|
mrr = vec3(0.0, 0.6, 0.2);
|
|
55
55
|
}`)}
|
|
56
56
|
float additionalIrradiance = 0.02 * mainLightIntensity[2];
|
|
57
|
-
${
|
|
58
|
-
vec3 shadingNormal = ${
|
|
57
|
+
${W(U,"mat3 tangentSpace = computeTangentSpace(fragmentShadingNormal, vPositionWorldCameraRelative, vuv0);")}
|
|
58
|
+
vec3 shadingNormal = ${U?"computeTextureNormal(tangentSpace, vuv0)":"fragmentShadingNormal"};
|
|
59
59
|
vec3 normalGround = ${K?P`normalize(positionWorld())`:P`vec3(0.0, 0.0, 1.0)`};
|
|
60
60
|
|
|
61
61
|
vec3 viewDir = normalize(vPositionWorldCameraRelative);
|
|
62
62
|
float ssao = 1.0 - occlusion * evaluateAmbientOcclusionInverse();
|
|
63
|
-
${
|
|
63
|
+
${W(q,P`float snow = smoothstep(0.5, 0.55, dot(fragmentFaceNormal, normalize(positionWorld())));
|
|
64
64
|
materialColor.rgb = mix(materialColor.rgb, vec3(1.1), snow);
|
|
65
65
|
ssao = mix(ssao, 0.5 * ssao, snow);
|
|
66
66
|
shadingNormal = mix(shadingNormal, fragmentFaceNormal, snow);`)}
|
|
67
|
-
${
|
|
67
|
+
${W(X,"materialColor = materialColor * (1.0 - overlayColor.a) + overlayColor;")}
|
|
68
68
|
|
|
69
69
|
vec3 additionalLight = evaluateAdditionalLighting(ssao, positionWorld());
|
|
70
70
|
vec4 emission = getEmissions();
|
|
71
|
-
${
|
|
71
|
+
${W(K,"float additionalAmbientScale = additionalDirectedAmbientLight(positionWorld());")}
|
|
72
72
|
${K?P`float shadow = max(lightingGlobalFactor * (1.0 - additionalAmbientScale), evaluateShadow());`:"float shadow = evaluateShadow();"}
|
|
73
73
|
vec4 shadedColor = vec4(evaluateSceneLightingPBR(shadingNormal, materialColor.rgb, shadow, ssao, additionalLight, viewDir, normalGround, mrr, emission, additionalIrradiance), materialColor.a);
|
|
74
74
|
`)):(K&&x(_),ae&&_.uniforms.add(new B("ovNormalTex",(e=>e.overlay?.getTexture(a.WaterNormal)))),_.main.add(P`
|
|
75
|
-
${
|
|
75
|
+
${W(K,"float additionalAmbientScale = additionalDirectedAmbientLight(positionWorld());")}
|
|
76
76
|
float shadow = ${J?K?"max(lightingGlobalFactor * (1.0 - additionalAmbientScale), evaluateShadow())":"evaluateShadow()":K?"lightingGlobalFactor * (1.0 - additionalAmbientScale)":"0.0"};
|
|
77
77
|
|
|
78
|
-
${
|
|
78
|
+
${W(q,P`float snow = smoothstep(0.5, 0.55, dot(fragmentFaceNormal, normalize(positionWorld())));
|
|
79
79
|
materialColor.rgb = mix(materialColor.rgb, vec3(1), snow);`)}
|
|
80
80
|
|
|
81
81
|
// At global scale we create some additional ambient light based on the main light to simulate global illumination
|
|
82
82
|
float ssao = evaluateAmbientOcclusion();
|
|
83
83
|
vec3 additionalLight = evaluateAdditionalLighting(ssao, positionWorld());
|
|
84
84
|
|
|
85
|
-
${
|
|
85
|
+
${W(X,"materialColor = materialColor * (1.0 - overlayColor.a) + overlayColor;")}
|
|
86
86
|
|
|
87
87
|
vec4 shadedColor = vec4(evaluateSceneLighting(fragmentShadingNormal, materialColor.rgb, shadow, ssao, additionalLight), materialColor.a);
|
|
88
|
-
${
|
|
88
|
+
${W(ae,P`vec4 overlayWaterMask = getOverlayColor(ovNormalTex, vtcOverlay);
|
|
89
89
|
float waterNormalLength = length(overlayWaterMask);
|
|
90
90
|
if (waterNormalLength > 0.95) {
|
|
91
91
|
mat3 tbnMatrix = mat3(tbnTangent, tbnBiTangent, groundNormal);
|
|
@@ -94,13 +94,13 @@ import{earth as e,mars as o,moon as r}from"../geometry/support/Ellipsoid.js";imp
|
|
|
94
94
|
// un-gamma the ground color to mix in linear space
|
|
95
95
|
shadedColor = mix(shadedColor, waterColorNonLinear, waterColorLinear.w);
|
|
96
96
|
}`)}
|
|
97
|
-
`)),_.main.add("outputColorHighlightOID(shadedColor, vPositionWorldCameraRelative);"),F;const ne=G===
|
|
97
|
+
`)),_.main.add("outputColorHighlightOID(shadedColor, vPositionWorldCameraRelative);"),F;const ne=G===d.Normal,de=G===d.ObjectAndLayerIdColor,se=G===d.Highlight,ge=oe||G===d.ViewshedShadow;return ge&&F.include(h,V),ne&&F.include(b,V),X&&F.include(p,V),F.include(w,V),_.main.add(P`
|
|
98
98
|
discardBySlice(vPositionWorldCameraRelative);
|
|
99
99
|
|
|
100
100
|
vec4 textureColor = readBaseColorTexture();
|
|
101
101
|
discardOrAdjustAlpha(textureColor);
|
|
102
102
|
|
|
103
|
-
${
|
|
104
|
-
${
|
|
105
|
-
${
|
|
106
|
-
${
|
|
103
|
+
${W(ge,"outputDepth(linearDepth);")}
|
|
104
|
+
${W(ne,P`fragColor = vec4(vec3(0.5) + 0.5 * fragmentFaceNormalView, 1.0);`)}
|
|
105
|
+
${W(de,X?"fragColor = getOverlayColorTexel();":"outputObjectAndLayerIdColor();")}
|
|
106
|
+
${W(se,W(X,P`calculateOcclusionAndOutputHighlight(getAllOverlayHighlightValuesEncoded());`,P`calculateOcclusionAndOutputHighlight();`))}`),F}const F=Object.freeze(Object.defineProperty({__proto__:null,build:V},Symbol.toStringTag,{value:"Module"}));export{F as C,V as b};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{set as e,copy as o}from"../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{ZEROS as r,fromValues as t}from"../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as l}from"../geometry/support/Ellipsoid.js";import{ShaderOutput as a}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RejectBySlice as s}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{ObjectAndLayerIdColor as n}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{AlignPixel as c}from"../views/3d/webgl-engine/core/shaderLibrary/hud/AlignPixel.glsl.js";import{HUD as d}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js";import{HUDOcclusionPass as u}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js";import{HUDVisibility as f}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUDVisibility.glsl.js";import{OutputHighlight as p}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{VisualVariables as m}from"../views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js";import{ColorConversion as g}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{RgbaFloatEncoding as v}from"../views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import{ScreenSizePerspective as b,addScreenSizePerspective as h,addScreenSizePerspectiveAlignment as x}from"../views/3d/webgl-engine/core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import{addPixelRatio as w}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2PassUniform as C}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{Float4BindUniform as P}from"../views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js";import{Float4DrawUniform as z}from"../views/3d/webgl-engine/core/shaderModules/Float4DrawUniform.js";import{Float4PassUniform as S}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as j}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{FloatPassUniform as y}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as A,If as O}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DBindUniform as $}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as F}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{OITPass as T}from"../views/3d/webgl-engine/lib/OITPass.js";import{VertexAttribute as D}from"../views/3d/webgl-engine/lib/VertexAttribute.js";import{ShaderBuilder as E}from"../views/webgl/ShaderBuilder.js";import{alphaCutoff as L}from"../webscene/support/AlphaCutoff.js";const B={occludedFadeFactor:1};function U(o){const i=new E,{signedDistanceFieldEnabled:B,occlusionTestEnabled:U,horizonCullingEnabled:R,pixelSnappingEnabled:I,hasScreenSizePerspective:q,debugDrawLabelBorder:k,vvSize:G,vvColor:N,hasRotation:Z,occludedFragmentFade:J,sampleSignedDistanceFieldTexelCenter:K}=o;i.include(d,o),i.vertex.include(s,o);const{occlusionPass:Q,output:W,oitPass:X}=o;if(Q)return i.include(u,o),i;const{vertex:Y,fragment:ee}=i;i.include(b),i.include(m,o),i.include(n,o),i.include(f),ee.include(v),ee.include(g),i.varyings.add("vcolor","vec4"),i.varyings.add("vtc","vec2"),i.varyings.add("vsize","vec2");const oe=W===a.Highlight,ie=oe&&U;ie&&i.varyings.add("voccluded","float"),Y.uniforms.add(new P("viewport",(e=>e.camera.fullViewport)),new C("screenOffset",((o,i)=>e(V,2*o.screenOffset[0]*i.camera.pixelRatio,2*o.screenOffset[1]*i.camera.pixelRatio))),new C("anchorPosition",(e=>H(e))),new S("materialColor",(e=>e.color)),new y("materialRotation",(e=>e.rotation)),new F("tex",(e=>e.texture))),w(Y),B&&(Y.uniforms.add(new S("outlineColor",(e=>e.outlineColor))),ee.uniforms.add(new S("outlineColor",(e=>M(e)?e.outlineColor:r)),new y("outlineSize",(e=>M(e)?e.outlineSize:0)))),R&&Y.uniforms.add(new z("pointDistanceSphere",((e,o)=>{const i=o.camera.eye,r=e.origin;return t(r[0]-i[0],r[1]-i[1],r[2]-i[2],l.radius)}))),I&&Y.include(c),q&&(h(Y),x(Y)),k&&i.varyings.add("debugBorderCoords","vec4"),i.attributes.add(D.UVI,"vec2"),i.attributes.add(D.COLOR,"vec4"),i.attributes.add(D.SIZE,"vec2"),i.attributes.add(D.ROTATION,"float"),i.attributes.add(D.FEATUREATTRIBUTE,"vec4"),Y.code.add(R?A`bool behindHorizon(vec3 posModel) {
|
|
5
|
+
import{set as e,copy as o}from"../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{ZEROS as r,fromValues as t}from"../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as l}from"../geometry/support/Ellipsoid.js";import{ShaderOutput as a}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RejectBySlice as s}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{ObjectAndLayerIdColor as n}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{AlignPixel as c}from"../views/3d/webgl-engine/core/shaderLibrary/hud/AlignPixel.glsl.js";import{HUD as d}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js";import{HUDOcclusionPass as u}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js";import{HUDVisibility as f}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUDVisibility.glsl.js";import{OutputHighlight as p}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{VisualVariables as m}from"../views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js";import{ColorConversion as g}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{RgbaFloatEncoding as v}from"../views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import{ScreenSizePerspective as b,addScreenSizePerspective as h,addScreenSizePerspectiveAlignment as x}from"../views/3d/webgl-engine/core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import{addPixelRatio as w}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2PassUniform as C}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{Float4BindUniform as P}from"../views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js";import{Float4DrawUniform as z}from"../views/3d/webgl-engine/core/shaderModules/Float4DrawUniform.js";import{Float4PassUniform as S}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as j}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{FloatPassUniform as y}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as A,If as O}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DBindUniform as $}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as F}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{OITPass as T}from"../views/3d/webgl-engine/lib/OITPass.js";import{VertexAttribute as D}from"../views/3d/webgl-engine/lib/VertexAttribute.js";import{ShaderBuilder as E}from"../views/webgl/ShaderBuilder.js";import{alphaCutoff as L}from"../webscene/support/AlphaCutoff.js";const B={occludedFadeFactor:1};function U(o){const i=new E,{signedDistanceFieldEnabled:B,occlusionTestEnabled:U,horizonCullingEnabled:R,pixelSnappingEnabled:I,hasScreenSizePerspective:q,debugDrawLabelBorder:k,vvSize:G,vvColor:N,hasRotation:Z,occludedFragmentFade:J,sampleSignedDistanceFieldTexelCenter:K}=o;i.include(d,o),i.vertex.include(s,o);const{occlusionPass:Q,output:W,oitPass:X}=o;if(Q)return i.include(u,o),i;const{vertex:Y,fragment:ee}=i;i.include(b),i.include(m,o),i.include(n,o),U&&i.include(f),ee.include(v),ee.include(g),i.varyings.add("vcolor","vec4"),i.varyings.add("vtc","vec2"),i.varyings.add("vsize","vec2");const oe=W===a.Highlight,ie=oe&&U;ie&&i.varyings.add("voccluded","float"),Y.uniforms.add(new P("viewport",(e=>e.camera.fullViewport)),new C("screenOffset",((o,i)=>e(V,2*o.screenOffset[0]*i.camera.pixelRatio,2*o.screenOffset[1]*i.camera.pixelRatio))),new C("anchorPosition",(e=>H(e))),new S("materialColor",(e=>e.color)),new y("materialRotation",(e=>e.rotation)),new F("tex",(e=>e.texture))),w(Y),B&&(Y.uniforms.add(new S("outlineColor",(e=>e.outlineColor))),ee.uniforms.add(new S("outlineColor",(e=>M(e)?e.outlineColor:r)),new y("outlineSize",(e=>M(e)?e.outlineSize:0)))),R&&Y.uniforms.add(new z("pointDistanceSphere",((e,o)=>{const i=o.camera.eye,r=e.origin;return t(r[0]-i[0],r[1]-i[1],r[2]-i[2],l.radius)}))),I&&Y.include(c),q&&(h(Y),x(Y)),k&&i.varyings.add("debugBorderCoords","vec4"),i.attributes.add(D.UVI,"vec2"),i.attributes.add(D.COLOR,"vec4"),i.attributes.add(D.SIZE,"vec2"),i.attributes.add(D.ROTATION,"float"),i.attributes.add(D.FEATUREATTRIBUTE,"vec4"),Y.code.add(R?A`bool behindHorizon(vec3 posModel) {
|
|
6
6
|
vec3 camToEarthCenter = pointDistanceSphere.xyz - localOrigin;
|
|
7
7
|
vec3 camToPos = pointDistanceSphere.xyz + posModel;
|
|
8
8
|
float earthRadius = pointDistanceSphere.w;
|
|
@@ -88,7 +88,7 @@ posProj = alignToPixelOrigin(posProj, viewport.zw);
|
|
|
88
88
|
|
|
89
89
|
${O(k,A`debugBorderCoords = vec4(uv01, 1.5 / combinedSize);`)}
|
|
90
90
|
vsize = inputSize;
|
|
91
|
-
`),ee.uniforms.add(new F("tex",(e=>e.texture))),J&&
|
|
91
|
+
`),ee.uniforms.add(new F("tex",(e=>e.texture))),J&&!oe&&ee.uniforms.add(new $("depthMap",(e=>e.mainDepth)),new j("occludedOpacity",(e=>e.hudOccludedFragmentOpacity)));const le=k?A`(isBorder > 0.0 ? 0.0 : ${A.float(L)})`:A.float(L),ae=A`
|
|
92
92
|
${O(k,A`float isBorder = float(any(lessThan(debugBorderCoords.xy, debugBorderCoords.zw)) || any(greaterThan(debugBorderCoords.xy, 1.0 - debugBorderCoords.zw)));`)}
|
|
93
93
|
|
|
94
94
|
vec2 samplePos = vtc;
|
|
@@ -2,52 +2,52 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{markerTextureSize as e,markerSymbolSize as r,markerTipThicknessFactor as i}from"../views/3d/support/engineContent/marker.js";import{SliceDraw as o}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{RibbonVertexPosition as t}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import{OutputHighlight as a}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{MarkerSizing as n}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js";import{terrainDepthTest as s}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{ColorConversion as
|
|
5
|
+
import{markerTextureSize as e,markerSymbolSize as r,markerTipThicknessFactor as i}from"../views/3d/support/engineContent/marker.js";import{SliceDraw as o}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{RibbonVertexPosition as t}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import{OutputHighlight as a}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{MarkerSizing as n}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js";import{terrainDepthTest as s}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{ColorConversion as l}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{RgbaFloatEncoding as c}from"../views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import{addProjViewLocalOrigin as p,addViewNormal as d,addPixelRatio as v}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2BindUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js";import{Float4BindUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js";import{Float4PassUniform as f}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as g}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{glsl as u,If as w}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as S}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DPassUniform as y}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{VertexAttribute as b}from"../views/3d/webgl-engine/lib/VertexAttribute.js";import{LineMarkerSpace as x,LineMarkerAnchor as P}from"../views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js";import{outputColorHighlightOID as z}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js";import{ShaderBuilder as j}from"../views/webgl/ShaderBuilder.js";function L(L){const k=new j,{space:M,anchor:D,hasTip:C}=L,$=M===x.World;k.include(t,L),k.include(n,L),k.include(s,L);const{vertex:O,fragment:T,varyings:W}=k;T.include(c),p(O,L),k.attributes.add(b.POSITION,"vec3"),k.attributes.add(b.PREVIOUSDELTA,"vec4"),k.attributes.add(b.UV0,"vec2"),W.add("vColor","vec4"),W.add("vpos","vec3",{invariant:!0}),W.add("vUV","vec2"),W.add("vSize","float"),C&&W.add("vLineWidth","float"),O.uniforms.add(new m("nearFar",(({camera:e})=>e.nearFar)),new h("viewport",(({camera:e})=>e.fullViewport))).code.add(u`vec4 projectAndScale(vec4 pos) {
|
|
6
6
|
vec4 posNdc = proj * pos;
|
|
7
7
|
posNdc.xy *= viewport.zw / posNdc.w;
|
|
8
8
|
return posNdc;
|
|
9
|
-
}`)
|
|
9
|
+
}`),O.code.add(u`void clip(vec4 pos, inout vec4 prev) {
|
|
10
10
|
float vnp = nearFar[0] * 0.99;
|
|
11
11
|
if (prev.z > -nearFar[0]) {
|
|
12
12
|
float interpolation = (-vnp - pos.z) / (prev.z - pos.z);
|
|
13
13
|
prev = mix(pos, prev, interpolation);
|
|
14
14
|
}
|
|
15
|
-
}`)
|
|
15
|
+
}`),$?(k.attributes.add(b.NORMAL,"vec3"),d(O),O.constants.add("tiltThreshold","float",.7),O.code.add(u`vec3 perpendicular(vec3 v) {
|
|
16
16
|
vec3 n = (viewNormal * vec4(normal.xyz, 1.0)).xyz;
|
|
17
17
|
vec3 n2 = cross(v, n);
|
|
18
18
|
vec3 forward = vec3(0.0, 0.0, 1.0);
|
|
19
19
|
float tiltDot = dot(forward, n);
|
|
20
20
|
return abs(tiltDot) < tiltThreshold ? n : n2;
|
|
21
|
-
}`))
|
|
21
|
+
}`)):O.code.add(u`vec2 perpendicular(vec2 v) {
|
|
22
22
|
return vec2(v.y, -v.x);
|
|
23
|
-
}`);const
|
|
24
|
-
${
|
|
25
|
-
${
|
|
23
|
+
}`);const U=$?"vec3":"vec2";return O.code.add(u`
|
|
24
|
+
${U} normalizedSegment(${U} pos, ${U} prev) {
|
|
25
|
+
${U} segment = pos - prev;
|
|
26
26
|
float segmentLen = length(segment);
|
|
27
27
|
|
|
28
28
|
// normalize or zero if too short
|
|
29
|
-
return (segmentLen > 0.001) ? segment / segmentLen : ${
|
|
29
|
+
return (segmentLen > 0.001) ? segment / segmentLen : ${$?"vec3(0.0, 0.0, 0.0)":"vec2(0.0, 0.0)"};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
${
|
|
33
|
-
${
|
|
32
|
+
${U} displace(${U} pos, ${U} prev, float displacementLen) {
|
|
33
|
+
${U} segment = normalizedSegment(pos, prev);
|
|
34
34
|
|
|
35
|
-
${
|
|
36
|
-
${
|
|
35
|
+
${U} displacementDirU = perpendicular(segment);
|
|
36
|
+
${U} displacementDirV = segment;
|
|
37
37
|
|
|
38
|
-
${
|
|
38
|
+
${D===P.Tip?"pos -= 0.5 * displacementLen * displacementDirV;":""}
|
|
39
39
|
|
|
40
40
|
return pos + displacementLen * (uv0.x * displacementDirU + uv0.y * displacementDirV);
|
|
41
41
|
}
|
|
42
|
-
`),M===x.Screen&&(
|
|
42
|
+
`),M===x.Screen&&(O.uniforms.add(new S("inverseProjectionMatrix",(({camera:e})=>e.inverseProjectionMatrix))),O.code.add(u`vec3 inverseProject(vec4 posScreen) {
|
|
43
43
|
posScreen.xy = (posScreen.xy / viewport.zw) * posScreen.w;
|
|
44
44
|
return (inverseProjectionMatrix * posScreen).xyz;
|
|
45
|
-
}`)
|
|
45
|
+
}`),O.code.add(u`bool rayIntersectPlane(vec3 rayDir, vec3 planeOrigin, vec3 planeNormal, out vec3 intersection) {
|
|
46
46
|
float cos = dot(rayDir, planeNormal);
|
|
47
47
|
float t = dot(planeOrigin, planeNormal) / cos;
|
|
48
48
|
intersection = t * rayDir;
|
|
49
49
|
return abs(cos) > 0.001 && t > 0.0;
|
|
50
|
-
}`)
|
|
50
|
+
}`),O.uniforms.add(new g("perScreenPixelRatio",(({camera:e})=>e.perScreenPixelRatio))),O.code.add(u`
|
|
51
51
|
vec4 toFront(vec4 displacedPosScreen, vec3 posLeft, vec3 posRight, vec3 prev, float lineWidth) {
|
|
52
52
|
// Project displaced position back to camera space
|
|
53
53
|
vec3 displacedPos = inverseProject(displacedPosScreen);
|
|
@@ -76,7 +76,7 @@ return abs(cos) > 0.001 && t > 0.0;
|
|
|
76
76
|
displacedPos *= minDepth / length(displacedPos);
|
|
77
77
|
return vec4(displacedPos.xyz, 1.0);
|
|
78
78
|
}
|
|
79
|
-
`)),v(
|
|
79
|
+
`)),v(O),O.main.add(u`
|
|
80
80
|
// Check for special value of uv0.y which is used by the Renderer when graphics
|
|
81
81
|
// are removed before the VBO is recompacted. If this is the case, then we just
|
|
82
82
|
// project outside of clip space.
|
|
@@ -89,10 +89,10 @@ return abs(cos) > 0.001 && t > 0.0;
|
|
|
89
89
|
float screenMarkerSize = getScreenMarkerSize();
|
|
90
90
|
|
|
91
91
|
vec4 pos = view * vec4(position, 1.0);
|
|
92
|
-
vec4 prev = view * vec4(
|
|
92
|
+
vec4 prev = view * vec4(position + previousDelta.xyz * previousDelta.w, 1.0);
|
|
93
93
|
clip(pos, prev);
|
|
94
94
|
|
|
95
|
-
${
|
|
95
|
+
${$?u`${w(L.hideOnShortSegments,u`
|
|
96
96
|
if (areWorldMarkersHidden(pos, prev)) {
|
|
97
97
|
// Project out of clip space
|
|
98
98
|
gl_Position = vec4(1e038, 1e038, 1e038, 1.0);
|
|
@@ -121,8 +121,8 @@ return abs(cos) > 0.001 && t > 0.0;
|
|
|
121
121
|
|
|
122
122
|
// Convert texture coordinate into [0,1]
|
|
123
123
|
vUV = (uv0 + 1.0) / 2.0;
|
|
124
|
-
${w(
|
|
125
|
-
${w(
|
|
124
|
+
${w(!$,"vUV *= displacedPosScreen.w;")}
|
|
125
|
+
${w(C,"vLineWidth = lineWidth;")}
|
|
126
126
|
|
|
127
127
|
vSize = screenMarkerSize;
|
|
128
128
|
vColor = getColor();
|
|
@@ -131,13 +131,13 @@ return abs(cos) > 0.001 && t > 0.0;
|
|
|
131
131
|
vpos = pos.xyz;
|
|
132
132
|
|
|
133
133
|
gl_Position = displacedPosScreen;
|
|
134
|
-
}`),T.include(o,L),k.include(z,L),T.include(
|
|
134
|
+
}`),T.include(o,L),k.include(z,L),T.include(l),T.uniforms.add(new f("intrinsicColor",(({color:e})=>e)),new y("tex",(({markerTexture:e})=>e))).constants.add("texelSize","float",1/e).code.add(u`float markerAlpha(vec2 samplePos) {
|
|
135
135
|
samplePos += vec2(0.5, -0.5) * texelSize;
|
|
136
136
|
float sdf = rgbaTofloat(texture(tex, samplePos)) - 0.5;
|
|
137
137
|
float distance = sdf * vSize;
|
|
138
138
|
distance -= 0.5;
|
|
139
139
|
return clamp(0.5 - distance, 0.0, 1.0);
|
|
140
|
-
}`),
|
|
140
|
+
}`),C&&T.constants.add("relativeMarkerSize","float",r/e).constants.add("relativeTipLineWidth","float",i).code.add(u`
|
|
141
141
|
float tipAlpha(vec2 samplePos) {
|
|
142
142
|
// Convert coordinates s.t. they are in pixels and relative to the tip of an arrow marker
|
|
143
143
|
samplePos -= vec2(0.5, 0.5 + 0.5 * relativeMarkerSize);
|
|
@@ -146,7 +146,7 @@ return clamp(0.5 - distance, 0.0, 1.0);
|
|
|
146
146
|
float halfMarkerSize = 0.5 * relativeMarkerSize * vSize;
|
|
147
147
|
float halfTipLineWidth = 0.5 * max(1.0, relativeTipLineWidth * vLineWidth);
|
|
148
148
|
|
|
149
|
-
${w(
|
|
149
|
+
${w($,"halfTipLineWidth *= fwidth(samplePos.y);")}
|
|
150
150
|
|
|
151
151
|
float distance = max(abs(samplePos.x) - halfMarkerSize, abs(samplePos.y) - halfTipLineWidth);
|
|
152
152
|
return clamp(0.5 - distance, 0.0, 1.0);
|
|
@@ -158,6 +158,6 @@ return clamp(0.5 - distance, 0.0, 1.0);
|
|
|
158
158
|
vec4 finalColor = intrinsicColor * vColor;
|
|
159
159
|
|
|
160
160
|
// Cancel out perspective correct interpolation if in screen space or draped
|
|
161
|
-
vec2 samplePos = vUV ${w(
|
|
162
|
-
finalColor.a *= ${
|
|
161
|
+
vec2 samplePos = vUV ${w(!$,"* gl_FragCoord.w")};
|
|
162
|
+
finalColor.a *= ${C?"max(markerAlpha(samplePos), tipAlpha(samplePos))":"markerAlpha(samplePos)"};
|
|
163
163
|
outputColorHighlightOID(finalColor, vpos);`),k}const k=Object.freeze(Object.defineProperty({__proto__:null,build:L},Symbol.toStringTag,{value:"Module"}));export{k as L,L as b};
|
package/chunks/Point2D.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{b as t,g as s,n as i,t as e}from"./Geometry.js";class n{constructor(t){this.sum=t,this.compensation=0}assign(t){return this.compensation=t.compensation,this.sum=t.sum,this}reset(){this.sum=this.compensation=0}resetToStart(t){this.sum=t,this.compensation=0}normalize(){const t=[Number.NaN];this.sum=lt(this.sum,this.compensation,t),this.compensation=t[0]}add(t){const s=this.sum+t;let i;if(Math.abs(this.sum)>=Math.abs(t)){const e=this.sum-s+t;i=this.compensation+e}else{const e=t-s+this.sum;i=this.compensation+e}this.sum=s,this.compensation=i}sub(t){this.add(-t)}addProduct(t,s){const i=[0],e=ut(t,s,i);this.add(e),this.add(i[0])}mul(t){const s=new n(0);s.addProduct(this.sum,t),s.addProduct(this.compensation,t),this.assign(s)}getResult(){return this.sum+this.compensation}pe(t){return this.add(t),this}me(t){return this.add(-t),this}}const r=0x00000000ffffffffn,u=0x0000ffffn,h=0x000000ffn,a=0x0fn,o=0xffff0000n,m=0xff00n,l=0xf0n,c=[5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1],f=[-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3];function _(t){let s=0;return t&u||(s+=16,t>>=16n),t&h||(s+=8,t>>=8n),t&a||(s+=4,t>>=4n),s+c[Number(BigInt.asUintN(4,t))]}function v(t){let s=0;return t&o&&(s+=16,t>>=16n),t&m&&(s+=8,t>>=8n),t&l&&(s+=4,t>>=4n),s+f[Number(BigInt.asUintN(4,t))]+1}function b(t){let s=0;return t&r||(s=32,t>>=32n),s+_(BigInt.asUintN(32,t))}function d(t){let s=0;return 0xffffffff00000000n&t&&(s=32,t>>=32n),s+v(t)}class x{constructor(t,s){if(this.m_EnvelopeType=1,void 0!==t){if(t instanceof x)return this.vmin=t.vmin,void(this.vmax=t.vmax);this.vmin=t,this.vmax=s,this.normalize()}else this.setEmpty()}static construct(t,s){return new x(t,s)}static constructEmpty(){return new x}setCoords(t,s){this.vmin=t,this.vmax=s,this.normalize()}setCoordsFromEnvelope(t){this.vmin=t.vmin,this.vmax=t.vmax}setEmpty(){this.vmin=Number.NaN,this.vmax=Number.NaN}getCenter(){return.5*(this.vmin+this.vmax)}equalsRange(t,s){return rs(this.vmin,t)&&rs(this.vmax,s)}equals(t,s){return!(!this.isEmpty()||!t.isEmpty())||(void 0!==s?Math.abs(this.vmin-t.vmin)<=s&&Math.abs(this.vmax-t.vmax)<=s:this.vmin===t.vmin&&this.vmax===t.vmax)}width(){return this.vmax-this.vmin}isEmpty(){return Number.isNaN(this.vmin)||Number.isNaN(this.vmax)}isZero(){return this.vmin===this.vmax}setInfinite(){this.vmin=Number.NEGATIVE_INFINITY,this.vmax=Number.POSITIVE_INFINITY}move(t){this.isEmpty()||(this.vmin+=t,this.vmax+=t)}contains(t){return t.vmin>=this.vmin&&t.vmax<=this.vmax}containsCoordinate(t){return t>=this.vmin&&t<=this.vmax}containsRightExclusive(t){return t>=this.vmin&&t<this.vmax}containsExclusiveCoordinate(t){return t>this.vmin&&t<this.vmax}containsExclusive(t){return t.vmin>this.vmin&&t.vmax<this.vmax}isIntersecting(t){return this.vmin<=t.vmin?this.vmax>=t.vmin:t.vmax>=this.vmin}mergeCoordinate(t){if(this.isEmpty())return this.vmin=t,void(this.vmax=t);this.mergeNeCoordinate(t)}merge(t){if(t.isEmpty())return;const s=t.vmin,i=t.vmax;this.mergeCoordinate(s),this.mergeCoordinate(i)}mergeNe(t){const s=t.vmin,i=t.vmax;this.mergeNeCoordinate(s),this.mergeNeCoordinate(i)}mergeNeCoordinate(t){t<this.vmin?this.vmin=t:t>this.vmax&&(this.vmax=t)}intersect(t){this.isEmpty()||t.isEmpty()?this.setEmpty():(this.vmin<t.vmin&&(this.vmin=t.vmin),this.vmax>t.vmax&&(this.vmax=t.vmax),this.vmin>this.vmax&&this.setEmpty())}inflate(t){this.isEmpty()||(this.vmin-=t,this.vmax+=t,this.vmax<this.vmin&&this.setEmpty())}normalize(){this.vmin<=this.vmax||(this.vmin>this.vmax?this.vmax=Mt(this.vmin,this.vmin=this.vmax):this.setEmpty())}isValid(){return this.isEmpty()||this.vmin<=this.vmax}snapClip(t){return ks(t,this.vmin,this.vmax)}calculateToleranceFromEnvelope(){if(this.isEmpty())return Cs();return(Math.abs(this.vmin)+Math.abs(this.vmax)+1)*Cs()}static unit(){return N}normalizeNoNAN(){this.vmin>this.vmax&&(this.vmax=Mt(this.vmin,this.vmin=this.vmax))}setCoordsNoNAN(t,s){this.vmin=t,this.vmax=s,this.normalizeNoNAN()}clone(){return new x(this.vmin,this.vmax)}}const N=new x(0,1);class p{static getNAN(){return new p(Number.NaN)}constructor(t,s){this.m_value=t??0,this.m_eps=s??0}[Symbol.toPrimitive](t){return this}clone(){return new p(this.m_value,this.m_eps)}assign(t){return this.m_value=t.m_value,this.m_eps=t.m_eps,this}scaleError(t){this.m_eps*=t}setError(t){this.m_eps=t}set(t,s){return this.m_value=t,this.m_eps=s??0,this}setWithEps(t,s){return void 0===s&&(s=1),this.m_value=t,this.m_eps=p.ulp(t)*s,this}setE(t){return this.m_value=t.m_value,this.m_eps=t.m_eps,this}precise(){return new p(this.m_value)}value(){return this.m_value}toDouble(){return this.m_value}eps(){return this.m_eps}resetError(){return this.m_eps=0,this}absThis(){return this.m_value=Math.abs(this.m_value),this}add(t){return this.clone().addThis(t)}addE(t){return this.clone().addThisE(t)}addThisE(t){const s=this.m_value+t.m_value,i=this.m_eps+t.m_eps+p.ulp(s);return this.m_value=s,this.m_eps=i,this}addThis(t){const s=this.m_value+t,i=this.m_eps+p.ulp(s);return this.m_value=s,this.m_eps=i,this}subE(t){return this.clone().subThisE(t)}sub(t){return this.clone().subThis(t)}subThisE(t){const s=this.m_value-t.m_value,i=this.m_eps+t.m_eps+p.ulp(s);return this.m_value=s,this.m_eps=i,this}subThis(t){const s=this.m_value-t,i=this.m_eps+p.ulp(s);return this.m_value=s,this.m_eps=i,this}setAddE(t,s){return this.m_value=t.m_value+s.m_value,this.m_eps=t.m_eps+s.m_eps+p.ulp(this.m_value),this}setAdd(t,s){return this.m_value=t+s,this.m_eps=p.ulp(this.m_value),this}setAddEN(t,s){return this.m_value=t.m_value+s,this.m_eps=t.m_eps+p.ulp(this.m_value),this}setAddNE(t,s){return this.m_value=t+s.m_value,this.m_eps=s.m_eps+p.ulp(this.m_value),this}setSubE(t,s){return this.m_value=t.m_value-s.m_value,this.m_eps=t.m_eps+s.m_eps+p.ulp(this.m_value),this}setSub(t,s){return this.m_value=t-s,this.m_eps=p.ulp(this.m_value),this}setSubEN(t,s){return this.m_value=t.m_value-s,this.m_eps=t.m_eps+p.ulp(this.m_value),this}setSubNE(t,s){return this.m_value=t-s.m_value,this.m_eps=s.m_eps+p.ulp(this.m_value),this}mulThisE(t){const s=this.m_value*t.m_value;return this.m_eps=this.m_eps*Math.abs(t.m_value)+t.m_eps*Math.abs(this.m_value)+this.m_eps*t.m_eps+p.ulp(s),this.m_value=s,this}mulThis(t){const s=this.m_value*t;return this.m_eps=this.m_eps*Math.abs(t)+p.ulp(s),this.m_value=s,this}mul(t){return this.clone().mulThis(t)}mulE(t){return this.clone().mulThisE(t)}setMulE(t,s){const i=t.m_value*s.m_value;return this.m_eps=t.m_eps*Math.abs(s.m_value)+s.m_eps*Math.abs(t.m_value)+t.m_eps*s.m_eps+p.ulp(i),this.m_value=i,this}setMul(t,s){return this.m_value=t*s,this.m_eps=p.ulp(this.m_value),this}setMulEN(t,s){return this.setE(t),this.mulThis(s)}setMulNE(t,s){return this.setE(s),this.mulThis(t)}mulThisByPower2(t){return this.m_value*=t,this.m_eps*=Math.abs(t),this}static st_mulByPower2(t,s){return new p(t.m_value,t.m_eps).mulThisByPower2(s)}divE(t){return this.clone().divThisE(t)}divThisE(t){const s=Math.abs(t.m_value),i=this.m_value/t.m_value;let e=(this.m_eps+Math.abs(i)*t.m_eps)/s;if(t.m_eps>.01*s){const i=t.m_eps/s;e*=1+(1+i)*i}return this.m_value=i,this.m_eps=e+p.ulp(i),this}divThis(t){const s=Math.abs(t);return this.m_value/=t,this.m_eps=this.m_eps/s+p.ulp(this.m_value),this}setDivE(t,s){return this.setE(t),this.divThisE(s)}setDiv(t,s){return this.m_value=t/s,this.m_eps=p.ulp(this.m_value),this}setDivEN(t,s){return this.setE(t),this.divThis(s)}setDivNE(t,s){return this.set(t),this.divThisE(s)}divThisByPower2(t){return this.m_value/=t,this.m_eps/=Math.abs(t),this}invThis(){return this.setE(w.clone().divThisE(this)),this}sqrt(){return this.clone().sqrtThis()}sqrtThis(){let t,s;return this.m_value>=0?(t=Math.sqrt(this.m_value),s=this.m_value>10*this.m_eps?.5*this.m_eps/t:this.m_value>this.m_eps?t-Math.sqrt(this.m_value-this.m_eps):Math.max(t,Math.sqrt(this.m_value+this.m_eps)-t),s+=p.ulp(t)):this.m_value<-this.m_eps?(t=Number.NaN,s=Number.NaN):(t=0,s=Math.sqrt(this.m_eps)),this.m_value=t,this.m_eps=s,this}sqr(){return this.clone().sqrThis()}sqrThis(){const t=this.m_value*this.m_value;return this.m_eps=2*this.m_eps*Math.abs(this.m_value)+this.m_eps*this.m_eps+p.ulp(t),this.m_value=t,this}setSin(t){const s=Math.sin(t.m_value),i=Math.cos(t.m_value);this.m_value=s;const e=Math.abs(s),n=Math.abs(t.value());return this.m_eps=(Math.abs(i)+.5*e*t.m_eps)*t.m_eps+p.ulp(e+n),this}static ulp(t){let s=ts(t);const i=((0x7ff0000000000000n&s)>>52n)-1075n;return i>-1023n?(s=i+0x3ffn<<52n,ss(s)):0===t?0:Number.MIN_VALUE}setCos(t){const s=Math.sin(t.m_value),i=Math.cos(t.m_value);this.m_value=i;const e=Math.abs(i),n=Math.abs(t.value());return this.m_eps=(Math.abs(s)+.5*e*t.m_eps)*t.m_eps+p.ulp(e+n),this}static st_cosAndSin(t,s,i){const e=Math.sin(t.m_value),n=Math.cos(t.m_value);i.m_value=e,s.m_value=n;const r=Math.abs(e),u=Math.abs(n),h=Math.abs(t.value());i.m_eps=(Math.abs(n)+.5*r*t.m_eps)*t.m_eps+p.ulp(r+h),s.m_eps=(Math.abs(e)+.5*u*t.m_eps)*t.m_eps+p.ulp(u+h)}negate(){return this.clone().negateThis()}negateThis(){return this.m_value=-this.m_value,this}setAbs(){return this.m_value=Math.abs(this.m_value),this}isInInterval(t){return x.construct(this.m_value-this.m_eps,this.m_value+this.m_eps).isIntersecting(t)}eq(t){return Math.abs(this.m_value-t.m_value)<=this.m_eps+t.m_eps}ne(t){return!this.eq(t)}gt(t){return this.m_value-t.m_value>this.m_eps+t.m_eps}lt(t){return t.m_value-this.m_value>this.m_eps+t.m_eps}ge(t){return!this.lt(t)}le(t){return!this.gt(t)}tolEQ(t,s){return Math.abs(this.m_value-t.m_value)<=s||this.eq(t)}tolNE(t,s){return!this.tolEQ(t,s)}tolGT(t,s){return this.m_value-t.m_value>s&&this.gt(t)}tolLT(t,s){return t.m_value-this.m_value>s&&this.lt(t)}tolGE(t,s){return!this.tolLT(t,s)}tolLE(t,s){return!this.tolGT(t,s)}isZero(){return Math.abs(this.m_value)<=this.m_eps}isFuzzyZero(){return this.isZero()&&0!==this.m_eps}tolIsZero(t){return Math.abs(this.m_value)<=Math.max(this.m_eps,t)}setPi(){this.setE(E)}setEuler(){this.set(2.718281828459045,M())}static size(){return 1}}function y(t,s){const i=is(t),e=is(s),n=53-b(i),r=53-b(e);return(n>=0?n:0)+(r>=0?r:0)<=52}function T(t,s){const i=t+s;return i-t===s&&i-s===t}function g(t,s){const i=t-s;return t-i===s&&s+i===t}function M(){return Ss()}p.dimensions=1;const E=new p(Math.PI,.5*M()),I=new p(0,0),w=new p(1,0),D=new p(4,0);function A(t,s,i){return t.addE(s.subE(t).mulE(i))}function P(t,s,i){return s.subE(s.subE(t).mulE(w.subE(i)))}function q(t){return Math.atanh(t)}function z(t){let s;if(0===t)s=1;else if(Math.abs(t)>.01)s=q(t)/t;else{let i;const e=-36.841361487904734;s=0;const n=t*t;for(let t=2*Math.trunc(e/Math.log(n)+2.5)-1;t>1;t-=2)i=1/t,s=(s+i)*n;s+=1}return s}function Z(t){const s=Math.PI*Math.PI/6;let i;if(1===t)i=s;else if(t>1)i=s;else if(0===t)i=t;else if(t<0){const s=1+(t=Math.abs(t)),e=Math.log(s);i=e*e/-2-Z(t/s)}else if(t>.5){const e=1-t,n=Math.log(t)*Math.log(e);i=s-Z(e)-n}else{i=0;const s=1+Math.trunc(-16*Math.log(10)/Math.log(t)+1.5);let e=s;for(let n=s;n>0;n--,e-=1)i*=t,i+=1/(e*e);i*=t}return i}function C(t,s){const i=s*t;if(Math.abs(s)<.1){let s=0;for(let t=60;t>=1;t--)s*=i,s+=1/t/t;return s*=t,s}return Z(i)/s}function R(t,s){return t<s?Qt(t,s):Qt(s,t)}function B(t,s){const i=Math.abs(t);return s>=0?i:-i}function S(t){return Math.round(t)}function F(t,s,i,e,n){n[0]=s[0]+(i[0]-s[0])*e,n[1]=s[1]+(i[1]-s[1])*e,3===t&&(n[2]=s[2]+(i[2]-s[2])*e)}function k(t,s,i,e,n){n[0]=i[0]-(i[0]-s[0])*(1-e),n[1]=i[1]-(i[1]-s[1])*(1-e),3===t&&(n[2]=i[2]-(i[2]-s[2])*(1-e))}function L(t,s,i,e,n){e<=.5?F(t,s,i,e,n):k(t,s,i,e,n)}function O(t,s,i,e,n){n[0]=s[0].addE(i[0].subE(s[0]).mulE(e)),n[1]=s[1].addE(i[1].subE(s[1]).mulE(e))}function G(t,s,i,e,n){n[0]=i[0].subE(i[0].subE(s[0]).mulE(w.subE(e))),n[1]=i[1].subE(i[1].subE(s[1]).mulE(w.subE(e)))}function Q(t,s,i){let e;return e=i<=.5?t+(s-t)*i:s-(s-t)*(1-i),e}function V(t,s,i){return t+(s-t)*i}function U(t,s,i){return s-(s-t)*(1-i)}function Y(t,s,i,e){i<=.5?(e.x=t.x+(s.x-t.x)*i,e.y=t.y+(s.y-t.y)*i):(e.x=s.x-(s.x-t.x)*(1-i),e.y=s.y-(s.y-t.y)*(1-i))}function j(t,s,i,e){i<=.5?(e.x=t.x+(s.x-t.x)*i,e.y=t.y+(s.y-t.y)*i,e.z=t.z+(s.z-t.z)*i):(e.x=s.x-(s.x-t.x)*(1-i),e.y=s.y-(s.y-t.y)*(1-i),e.z=s.z-(s.z-t.z)*(1-i))}function $(t){return t*t}function H(t){return t*t*t}function W(t){return 1/Math.sqrt(t)}function X(t){return t<0?-1:t>0?1:0}function J(t,s,i,e){const n=[0],r=[0],u=[0];return lt(ut(t,i,n),ut(s,e,r),u)+(n[0]+r[0]+u[0])}const K=[0],tt=[0];function st(t,s,i){return mt(ut(t,s,K),i,K[0],tt)}const it=[0],et=[0],nt=[0],rt=[0];function ut(t,s,i){const e=t*s;return ht(t,it,et),ht(s,nt,rt),i[0]=et[0]*rt[0]-(e-it[0]*nt[0]-et[0]*nt[0]-it[0]*rt[0]),e}function ht(t,s,i){const e=134217729*t;s[0]=e-(e-t),i[0]=t-s[0]}const at=[0],ot=[0];function mt(t,s,i,e){const n=lt(t,s,at),r=lt(n,i,ot);return lt(r,at[0]+ot[0],e)}function lt(t,s,i){const e=t+s;return Math.abs(t)>Math.abs(s)?i[0]=t-e+s:i[0]=s-e+t,e}function ct(t,s){return t%s}function ft(t){const s=1-t;if(0===s)return 1;let i;if(s<=.01){const t=s,e=Math.log(t);i=1+t*(.4431471805599453-.25*e+t*(.05680519270997949-.09375*e+t*(.02183137044373718-.05859375*e+t*(.011544521417308362-.042724609375*e+t*(.00714200031339596-.0336456298828125*e+t*(.004854743337164948-.027757644653320312*e+t*(.003514687963781376-.023627042770385742*e)))))))}else{if(t<.016){const s=t,i=.25,e=.046875,n=.01953125,r=.01068115234375,u=.0067291259765625,h=.004626274108886719,a=.0033752918243408203,o=.0025710230693221092;return Vs()*(1-s*(i+s*(e+s*(n+s*(r+s*(u+s*(h+s*(a+s*o))))))))}i=bt(0,s,1)-t*dt(0,s,1)/3}return ks(i,1,Vs())}function _t(t,i,e=Number.NaN){if(s(i>=0&&i<=1),0===i)return t;let n=1,r=t;if(r<0&&(r=-r,n=-1),1===i){const t=Math.round(r/Gs()),s=r-t*Gs();return n*(2*t+Math.sin(s))}const u=Vs(),h=Math.floor(r/u);1&h?r=(h+1)*u-r:r-=h*u;const a=Math.sin(r),o=Number.isNaN(e)?ft(i):e;let m;if(1===a)m=o+Math.sqrt(1-i)*(r-u);else{const t=r*r;if(.01424*Math.pow(t,4)<=2*Ss()){m=r*(1+t*i*(-1/6+t*((4-3*i)/120-(16+(45*i-60)*i)/5040*t)))}else if(i<=.01){const t=Math.sin(2*r),s=Math.sin(4*r),e=Math.sin(6*r),n=Math.sin(8*r),u=Math.sin(10*r);m=r+i*((2*-r+t)/8+i*((-3*r+2*t-.25*s)/64+i*((-20*r+15*t-3*s+e/3)/1024+i*(5*(-140*r+112*t-28*s+16/3*e-.5*n)/65536+7*i*((-63*r+52.5*t-15*s+3.75*e-.625*n+.05*u)/65536+i*(-693*r+594*t-185.625*s+1.375*e-12.375*n+1.8*u-.125*Math.sin(12*r))/1048576)))))}else{const t=a*a,s=Math.cos(r),e=s*s,n=xt(a,s,i);m=a*(bt(e,n,1)-i*t*dt(e,n,1)/3)}}if(1&h){m=o*(h+1)-m}else m+=o*h;return n*m}function vt(t,s,i=Number.NaN){if(0===t)return 0;let e=1,n=t;t<0&&(n=-n,e=-1);const r=Number.isNaN(i)?ft(s):i,u=Math.floor(n/r);1&u?n=(u+1)*r-n:n-=u*r;let h=n<=0?0:n>=r?Vs():Nt(n,s,r);return 1&u?h=Vs()*(u+1)-h:h+=Vs()*u,e*h}function bt(t,i,e){s((0!==t?1:0)+(0!==i?1:0)+1>1);let n=t,r=i,u=e;for(;;){const t=Math.sqrt(n*r)+Math.sqrt(r*u)+Math.sqrt(u*n);n=.25*(n+t),r=.25*(r+t),u=.25*(u+t);const s=(n+r+u)/3,i=(s-n)/s,e=(s-r)/s,h=(s-u)/s;if(Math.abs(i)<=.0024&&Math.abs(e)<=.0024&&Math.abs(h)<=.0024){const t=i*e-h*h,n=i*e*h;return(1+(1/24*t-.1-3/44*n-5*t*t/208+t*n/16)*t+(1/14+3*n/104)*n)/Math.sqrt(s)}}}function dt(t,i,e){s(0!==t||0!==i);let r=t,u=i,h=e;const a=new n(0);let o=1;for(;;){const t=.2*(r+u+3*h),s=(t-r)/t,i=(t-u)/t,e=(t-h)/t;if(Math.abs(s)<=.0015&&Math.abs(i)<=.0015&&Math.abs(e)<=.0015){const n=s*i,r=e*e,u=n-r,h=n-6*r,m=h+u+u,l=3/26,c=h*(.25*(9/22)*h-.21428571428571427-1.5*l*e*m),f=e*(1/6*m+e*(-.4090909090909091*u+e*l*n));return 3*a.getResult()+o*(1+c+f)/(t*Math.sqrt(t))}const n=Math.sqrt(r),m=Math.sqrt(u),l=Math.sqrt(h),c=n*(m+l)+m*l;a.add(o/(l*(h+c))),o*=.25,r=.25*(r+c),u=.25*(u+c),h=.25*(h+c)}}function xt(t,s,i){return t<.999?1-i*$(t):1-i+i*$(s)}function Nt(t,s,i){if(0===s)return t;if(1===s)return Math.asin(t);let e=0,n=!0;if(t<.2){const i=t*t,r=t*(1+i*s*(1/6+i*((13*s-4)/120+(16-284*s+493*s*s)/5040*i))),u=Math.abs(s*(4944*s-64-31224*s*s+37369*s*s*s)/362880*Math.pow(t,9));if(u<Math.abs(r)*Ss())return r;e=r,n=u>.1*r}if(n){const n=1-s,r=1-t/i,u=Math.sqrt(r*r+n*n),h=Math.atan2(n,t+Ss());e=Vs()+Math.sqrt(u)*(h-Vs())}let r=0;for(let u=0;u<7;u++){r=_t(e,s,i);const n=xt(Math.sin(e),Math.cos(e),s);if(e-=(r-t)/Math.sqrt(n),u>0&&Math.abs(r-t)<=4*Ss()*t)break}return e}function pt(s,i,e,n,r){return 0===s?0===n?i:1===n?e:r:1===s?0===n?i:1===n?e:Q(i,e,n):(2===s&&t("angular interpolation"),void t(""))}function yt(s,i,e,n,r,u,h,a){if(0===s)for(let t=0;t<u;++t)n[t+r]=0===h?i[t]:1===h?e[t]:a;else if(1===s)if(0===h)Tt(n,i,r,0,u);else if(1===h)Tt(n,e,r,0,u);else for(let t=0;t<u;++t)n[t+r]=Q(i[t],e[t],h);else if(2===s)if(0===h)Tt(n,i,r,0,u);else if(1===h)Tt(n,e,r,0,u);else{let t=0;for(let s=0,a=r;s<u;++s,++a)n[a]=Q(i[s],e[s],h),t+=n[a]*n[a];if(t>0){t=Math.sqrt(t);for(let s=r;s<r+u;++s)n[s]/=t}else{for(let t=r;t<r+u;++t)n[t]=0;n[r]=1}}else t("")}function Tt(t,s,i,e,n){if(0===n)return;let r=0,u=i,h=e;for(;r++<n;)t[u++]=s[h++]}function gt(t,s,i){let e=0;for(let n=0;!e&&n<i;++n)e=t[n]-s[n];return e}function Mt(t,s){return t}function Et(t){t.sort(((t,s)=>t<s?-1:t>s?1:0))}function It(t,s){const i=t.slice(0,s);Et(i),Tt(t,i,0,0,s)}function wt(t,s,i,e){const n=t.slice(s,s+i);n.sort(e),Tt(t,n,s,0,i)}function Dt(t,s){return t<s?-1:t>s?1:0}function At(t,s,i,e){return t<i?-1:t>i?1:s<e?-1:s>e?1:0}function Pt(t,s){if(t.length<2)return t.length;let i=0;for(let e=1;e<t.length;++e)s(t[e],t[i])||(i++,t[e]=Mt(t[i],t[i]=t[e]));return 1+i}function qt(t,s){t[s]=t.at(-1),t.pop()}function zt(t,s=!1){return{[Symbol.dispose](){this.bForget||t()},bForget:s}}function Zt(t,s,i){t.length=s,t.fill(i)}function Ct(t,s,i){t.length=i;for(let e=0;e<i;++e)t[e]=new s}function Rt(t,s){const i=new Array(s);for(let e=0;e<s;++e)i[e]=new t;return i}function Bt(t,s,i){for(let e=0;e<i;++e)t[e].assign(s[e]);return i}function St(t,s){const i=t.slice(0,s);for(let e=0;e<s;++e)i[e]=i[e].clone();return i}function Ft(t){return Array.from({length:t},(()=>null))}function kt(t,s){return Array.from({length:s},(()=>t()))}function Lt(t,s){const i=new Array(t);return i.fill(s),i}function Ot(t,s){return s in t&&1===Object.getOwnPropertyNames(t).length}class Gt{constructor(...t){this.m_elts=t}get length(){return this.m_elts.length}at(t){return this.m_elts[t]}[Symbol.dispose](){for(const t of this.m_elts)t[Symbol.dispose]()}}function Qt(t,s){return{first:t,second:s}}const Vt=Math.PI,Ut=2*Math.PI,Yt=.5*Math.PI;class jt{constructor(t,s){this.m_cr=t,this.m_cc=s,this.m_v=Lt(t*s,0)}get(t,s){return this.m_v[t*this.m_cc+s]}set(t,s,i){this.m_v[t*this.m_cc+s]=i}inc(t,s){return++this.m_v[t*this.m_cc+s]}}const $t=new ArrayBuffer(8),Ht=new Float64Array($t),Wt=new BigUint64Array($t),Xt=0x0fffffffffffffn,Jt=0x7ff0000000000000n;function Kt(){return Number.EPSILON*Zs}function ts(t){return Ht[0]=t,Wt[0]}function ss(t){return Wt[0]=t,Ht[0]}function is(t){return ts(t)&Xt}function es(t){return Number((ts(t)&Jt)>>52n)}function ns(t){if(0n===t)return-1n;if(1n===t||-1n===t)return 0n;t<0n&&(t=-t);let s=0n,i=512n,e=1n<<s+i;for(;t>=e;)s+=i,i<<=1n,e<<=i;let n=s;i>>=1n;let r=n+i;for(;i>0n;)t<1n<<r||(n=r),i>>=1n,r=n+i;return n}function rs(t,s){return t===s||Number.isNaN(t)&&Number.isNaN(s)}function us(t,s,i){return t===s||Math.abs(t-s)<=i||Number.isNaN(t)&&Number.isNaN(s)}function hs(t,s){return t<s?-1:t>s?1:0}function as(t,s){if(t<s)return-1;if(t>s)return 1;if(t===s)return 0;{const i=Number.isNaN(t),e=Number.isNaN(s);return i<e?-1:i>e?1:0}}function os(){return 2147483647}function ms(){return 32767}function ls(){return 2147483647}function cs(){return-2147483648}const fs=ls(),_s=BigInt(fs),vs=2166136261,bs=16777619;function ds(t){let s=vs,i=t;return s=(s^255&i)*bs,i>>=8,s=(s^255&i)*bs,i>>=8,s=(s^255&i)*bs,i>>=8,s=(s^255&i)*bs,s&fs}const xs=14695981039346656037n,Ns=1099511628211n;function ps(t){let s=xs,i=t;return s=(s^0xffn&i)*Ns,i>>=8n,s=(s^0xffn&i)*Ns,i>>=8n,s=(s^0xffn&i)*Ns,i>>=8n,s=(s^0xffn&i)*Ns,i>>=8n,s=(s^0xffn&i)*Ns,i>>=8n,s=(s^0xffn&i)*Ns,i>>=8n,s=(s^0xffn&i)*Ns,s&_s}function ys(t){return 1103515245*t+12345&2147483647}function Ts(t){let s=vs;for(let i=0,e=t.length;i<e;++i)s=(s^t.charCodeAt(i))*bs;return s&fs}function gs(t,s){return s+2654435769+(t<<6)+(t>>2)&fs}function Ms(t,s){return gs(t,Ds(s))}function Es(t){return gs(3735928559,t)}function Is(t,s){return gs(t,Es(s))}function ws(t){return ds(t)}function Ds(t){return Number(ps(t))}function As(t){return js(t)}function Ps(t){return Ds(ts(As(t)))}function qs(t){return ys(t)}const zs=100,Zs=100;function Cs(){return Number.EPSILON*zs}function Rs(){return.38196601125010515}function Bs(){return 1.4142135623730951}function Ss(){return Number.EPSILON}function Fs(t,s,i){return t===s||t===i}function ks(t,s,i){return t>=s?t<=i?t:i:s}function Ls(t,s,i){const e=t[0];if(e>=s){if(e<=i)return!1;t[0]=i}else t[0]=s;return!0}function Os(t,s){return t>=s?s:t<-s?-s:t}function Gs(){return Vt}function Qs(){return Ut}function Vs(){return Yt}const Us=3*Vs();function Ys(){return Us}function js(t){return t+0}function $s(t){return{v:t}}class Hs{constructor(){this.m_rn=$s(0n),this.m_rd=$s(1n),this.m_bNaN=!1,this.m_bNormalized=!1,this.m_power=0,this.m_sign=0}static constructAssign(t,s){const i=t.clone();return void 0!==s&&i.limitPrecisionThis(s),i}static constructDouble(t){return(new Hs).setDouble(t)}static constructInt64(t){return(new Hs).setInt64(t)}static constructRational(t,s){return(new Hs).setRational(t,s)}static constructInt32(t){return this.constructInt64(BigInt(Math.trunc(t)))}[Symbol.toPrimitive](t){return this}compare(t){return this.lt(t)?-1:this.gt(t)?1:0}assignCopy(t){return this.setThis(t)}abs(){return this.clone().absThis()}absThis(){return this.isNAN()||(this.m_sign*=this.m_sign),this}clone(){return(new Hs).setThis(this)}setThis(t){return this.m_bNaN=t.m_bNaN,this.m_bNormalized=t.m_bNormalized,this.m_rn.v=t.m_rn.v,this.m_rd.v=t.m_rd.v,this.m_power=t.m_power,this.m_sign=t.m_sign,this}setZero(){return this.m_rn.v=0n,this.m_rd.v=1n,this.m_bNaN=!1,this.m_power=0,this.m_bNormalized=!0,this.m_sign=0,this}setDouble(s){if(this.setZero(),0===s)return this;if(Number.isInteger(s)&&Math.abs(s)<ls())return this.setInt32(s);const i=ts(s),e=(i&Hs.s_em)>>52n,n=!!(i&Hs.s_sm),r=i&Hs.s_fm;if(e===Hs.s_emax)return r?(this.m_rn.v=this.m_rd.v=0n,this.m_bNaN=!0,this):(this.m_rn.v=n?-1n:1n,this.m_rd.v=0n,this);0n===e&&t("denormalized numbers not yet implemented");const u=e-1023n,h=u>=0n?u:0n,a=u<0n?-u:0n;return this.m_rn.v=(1n<<52n|r)<<h,this.m_rd.v=1n<<52n+a,this.m_sign=n?-1:1,this.m_bNormalized=!1,this.normalizeThis()}setInt64(t){return 0n===t?this.setZero():(this.m_bNaN=!1,this.m_sign=t>0n?1:-1,this.m_rn.v=t>0n?t:-t,this.m_rd.v=1n,this.m_power=0,this.m_bNormalized=!1,this.normalizeThis())}setRational(t,s){return 0n===t?0n===s?this.setNAN():this.setZero():0n===s?t>0n?this.setPositiveInf():this.setNegativeInf():(this.m_sign=(t>0n?1:-1)*(s>0n?1:-1),this.m_rn.v=t>0n?t:-t,this.m_rd.v=s>0n?s:-s,this.m_power=0,this.m_bNormalized=!1,this.normalizeThis())}setInt32(t){return this.setInt64(BigInt(Math.trunc(t)))}getDouble(){return this.convertToDouble()}toDouble(){return this.convertToDouble()}value(){return this.convertToDouble()}isNAN(){return this.m_bNaN}isPositiveInf(){return!this.isNAN()&&(0n===this.m_rd.v&&1===this.m_sign)}isNegativeInf(){return!this.isNAN()&&(0n===this.m_rd.v&&-1===this.m_sign)}isFinite(){return!this.isNAN()&&0n!==this.m_rd.v}setNAN(){return this.m_bNaN=!0,this.m_rn.v=0n,this.m_rd.v=0n,this.m_power=0,this.m_bNormalized=!0,this}setPositiveInf(){return this.m_rn.v=1n,this.m_rd.v=0n,this.m_bNaN=!1,this.m_bNormalized=!0,this.m_sign=1,this.m_power=0,this}setNegativeInf(){return this.m_rn.v=1n,this.m_rd.v=0n,this.m_bNaN=!1,this.m_bNormalized=!0,this.m_sign=-1,this.m_power=0,this}subThis(t){if(t.isNAN()&&this.setNAN(),this.isPositiveInf()&&t.isPositiveInf())this.setNAN();else{if(this.isPositiveInf()&&t.isNegativeInf())return this.setPositiveInf(),this;if(this.isNegativeInf()&&t.isNegativeInf())this.setNAN();else if(this.isNegativeInf()&&t.isPositiveInf())return this.setNegativeInf(),this}return this.isNAN()?this:this.opPlusMinus(t,!1)}thisSubAbs(t){return s(0),this}mulThis(t){return t.isNAN()&&this.setNAN(),this.isNAN()?this:(this.m_sign*=t.m_sign,0===this.m_sign?this.setZero():(this.m_rn.v*=t.m_rn.v,this.m_rd.v*=t.m_rd.v,this.m_power+=t.m_power,this.m_bNormalized=!1,this.normalizeThis(),this))}mulDoubleThis(t){return this.mulThis(Hs.constructDouble(t))}thisMulInt64(t){return s(0),this}thisMulInt32(t){return s(0),this}divThis(t){return this.mulThis(t.clone().invertThis())}divDoubleThis(t){return this.divThis(Hs.constructDouble(t))}addDoubleThis(t){return this.addThis(Hs.constructDouble(t))}subDoubleThis(t){return this.subThis(Hs.constructDouble(t))}mul(t){return this.clone().mulThis(t)}mulBigIntThis(t){return this.mulThis(Hs.constructInt64(t))}mulDouble(t){return this.clone().mulThis(Hs.constructDouble(t))}div(t){return this.clone().divThis(t)}divDouble(t){return this.clone().divDoubleThis(t)}add(t){return this.clone().addThis(t)}fmSubThis(t,s){return this.subThis(t.clone().mulThis(s))}fmAddThis(t,s){return this.addThis(t.clone().mulThis(s))}addThis(t){if(t.isNAN()&&this.setNAN(),this.isPositiveInf()&&t.isPositiveInf())return this.setPositiveInf(),this;if(this.isPositiveInf()&&t.isNegativeInf())this.setNAN();else{if(this.isNegativeInf()&&t.isNegativeInf())return this.setNegativeInf(),this;this.isNegativeInf()&&t.isPositiveInf()&&this.setNAN()}return this.isNAN()?this:this.opPlusMinus(t,!0)}addDouble(t){return this.clone().addThis(Hs.constructDouble(t))}sub(t){return this.clone().subThis(t)}subDouble(t){return this.clone().subThis(Hs.constructDouble(t))}isZero(){return 0===this.m_sign}equals(t){return this.clone().subThis(t).isZero()}lt(t){return!this.isNAN()&&!t.isNAN()&&(!(this.isPositiveInf()&&t.isPositiveInf()||this.isNegativeInf()&&t.isNegativeInf())&&(!this.isPositiveInf()&&(!!t.isPositiveInf()||this.clone().sub(t).LZ())))}absLessAbs(t){return this.abs().lt(t.abs())}gt(t){return this.clone().sub(t).GZ()}lte(t){return this.sub(t).LEZ()}gte(t){return this.sub(t).GEZ()}normalizeThis(){if(this.m_bNormalized)return this;if(0n===this.m_rn.v)return this.setZero();let t=0,s=0xffffffffn;for(;0n===(this.m_rn.v&s)&&s<=this.m_rn.v;)s<<=32n,t+=32;s&=this.m_rn.v,s>>=BigInt(t),t+=_(BigInt.asUintN(32,s))-1;let i=0;for(s=0xffffffffn;0n===(this.m_rd.v&s)&&s<=this.m_rd.v;)s<<=32n,i+=32;return s&=this.m_rd.v,s>>=BigInt(i),i+=_(BigInt.asUintN(32,s))-1,this.m_rn.v>>=BigInt(t),this.m_rd.v>>=BigInt(i),this.m_power+=t-i,this.m_rn.v>1n&&this.m_rd.v>1n&&(this.m_rn.v%this.m_rd.v===0n?(this.m_rn.v/=this.m_rd.v,this.m_rd.v=1n):this.m_rd.v%this.m_rn.v===0n&&(this.m_rd.v/=this.m_rn.v,this.m_rn.v=1n)),this.m_bNormalized=!0,this}negateThis(){return this.isNAN()||(this.m_sign*=-1),this}negate(){return this.clone().negateThis()}invertThis(){return this.isNAN()?this:this.isPositiveInf()||this.isNegativeInf()?(this.setZero(),this):0n===this.m_rn.v?(this.setPositiveInf(),this):(this.m_rd=Mt(this.m_rn,this.m_rn=this.m_rd),this.m_power=-this.m_power,this)}limitPrecisionThis(t){if(0===t)return this;if(this.isZero())return this.setZero();if(!this.isFinite())return this;this.normalizeThis();let s=Number(ns(this.m_rn.v));if(s>t){const i=s-t;this.m_rn.v>>=BigInt(s-t),this.m_power+=i}if(s=Number(ns(this.m_rd.v)),s>t){const i=s-t;this.m_rd.v>>=BigInt(s-t),this.m_power-=i}return this}hiBitIndex(){return Math.max(Number(ns(this.m_rn.v)),Number(ns(this.m_rd.v)))}ldexp(t){return this.clone().ldexpThis(t)}ldexpThis(t){return t&&(this.m_bNormalized=!1,this.m_power+=t,this.normalizeThis()),this}LZ(){return!this.isNAN()&&-1===this.m_sign}GZ(){return!this.isNAN()&&1===this.m_sign}LEZ(){return!this.isNAN()&&this.m_sign<=0}GEZ(){return!this.isNAN()&&this.m_sign>=0}toString(){return this.toDouble().toString()}sqr(){return this.clone().sqrThis()}sqrThis(){return this.mulThis(this.clone())}static sqrt(t,e){if(t.m_sign<0n&&i("MP_value: sqrt(-1)"),t.isZero())return t.clone();let n=52,r=2220446049250313e-31;for(;n<e;)2*n<=e?(r*=r,n*=2):(r*=2220446049250313e-31,n+=52);n+=52;const u=ns(t.m_rn.v),h=ns(t.m_rd.v);let a,o=t.m_power+Number(u-h);const m=new Hs;Math.abs(o)>200?(1&Math.abs(o)&&(o+=1),a=Hs.constructAssign(t,53).ldexpThis(-o).value(),m.setThis(t).ldexpThis(-o),s(Number.isFinite(a))):(m.setThis(t),a=m.value(),s(Number.isFinite(a)),o=0),a=Math.sqrt(a);const l=Hs.constructDouble(a),c=Hs.constructDouble(r);c.mulThis(l).ldexpThis(1);const f=r*a*2,_=l.clone(),v=new Hs;let b;for(let s=0;s<10;++s){_.mulThis(l),v.setThis(m).subThis(_).absThis();let t=v.value();if(b=1,t<.9)for(;t>f;)t*=t,++b;else b=4;if(v.lte(c))break;for(let s=0;s<b;s++)_.setThis(l).divThis(m).invertThis().addThis(l).ldexpThis(-1).limitPrecisionThis(n),l.setThis(_)}return l.ldexpThis(o/2)}static cubicRoot(t,s){if(t.isZero())return t.clone();let i=52,e=2220446049250313e-31;for(;i<s;)2*i<=s?(e*=e,i*=2):(e*=2220446049250313e-31,i+=52);i+=52;const n=Math.pow(Math.abs(t.value()),1/3),r=Hs.constructDouble(n),u=r.clone();u.sqrThis().mulDoubleThis(3).mulDoubleThis(e),u.limitPrecisionThis(32),t.LZ()&&r.negateThis();for(let h=0;h<10;++h){const s=r.clone();s.sqrThis().mulThis(r);const e=s.clone();if(e.subThis(t),e.absThis().limitPrecisionThis(32),e.lte(u))break;e.setThis(t),e.ldexpThis(1),e.addThis(s);const n=s.clone();n.ldexpThis(1),n.addThis(t),e.divThis(n),r.mulThis(e),r.limitPrecisionThis(i)}return r}isInTheRangeOfDouble(){return s(0),!1}sign(){return this.m_sign}cosAndSin(t,i){s(0)}static nan(){return s(0),new Hs}convertToDouble(){if(this.m_bNaN)return Number.NaN;if(this.isZero())return 0;if(0n===this.m_rd.v)return 1===this.m_sign?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;const t=-1===this.m_sign,s=this.m_rn.v<<(this.m_power>=0?BigInt(this.m_power):0n);let i=this.m_rd.v<<(this.m_power<0?BigInt(-this.m_power):0n);const e=s/i;let n=Number(e);if(BigInt(n)!==e)return t?-n:n;let r=s-e*i;if(r){let t=ns(i)-1023n;t>0n&&(i>>=t,r<<=52n,r>>=t);let s=Number(r);Number.isFinite(s)||(r>>=52n,s=Number(r),t=0n),t>0n&&(s/=Math.pow(2,52));n+=s/Number(i)}return t?-n:n}signVal(){return 1===this.m_sign?1n:-1===this.m_sign?-1n:0n}opPlusMinus(t,s){const i=Math.min(this.m_power,t.m_power);let e,n;this.m_power>i?(e=BigInt(this.m_power-i),n=0n):(e=0n,n=BigInt(t.m_power-i));const r=this.signVal()*this.m_rn.v*t.m_rd.v<<e,u=t.signVal()*t.m_rn.v*this.m_rd.v<<n;return this.m_rn.v=s?r+u:r-u,this.m_rd.v*=t.m_rd.v,this.m_power=i,this.m_sign=1,this.m_rn.v<0n&&(this.m_sign=-1,this.m_rn.v=-this.m_rn.v),this.m_bNormalized=!1,this.normalizeThis(),this}}Hs.s_sm=0x8000000000000000n,Hs.s_em=0x7ff0000000000000n,Hs.s_fm=0x000fffffffffffffn,Hs.s_emax=0x7ffn;const Ws=Hs.constructInt32(1),Xs=Hs.constructInt32(0);function Js(t,s){return d(t^s)}function Ks(t,s){let i=es(t);const e=es(s);if(i===e){return i-=53-Js(is(t),is(s)),i}return i>e?i:e}function ti(t,s){for(let i=0,e=0,n=t.length;i<n;i+=2,e++)s[e].x=t[i],s[e].y=t[i+1]}function si(t){const s=new Float64Array(2*t.length);for(let i=0,e=t.length;i<e;++i){const e=i<<1;s[e]=t[i].x,s[e+1]=t[i].y}return s}function ii(t){const s=Rt(ei,t.length);for(let i=0,e=t.length;i<e;++i)s[i].setCoords(t[i][0],t[i][1]);return s}class ei{static construct(t,s){return new ei(t,s)}constructor(t,s){void 0!==t?(this.x=t,this.y=s):this.x=this.y=Number.NaN}clone(){return new ei(this.x,this.y)}assign(t){this.setCoordsPoint2D(t)}setCoords(t,s){return this.x=t,this.y=s,this}setCoordsPoint2D(t){this.x=t.x,this.y=t.y}isEqualPoint2D(t,s){return void 0!==s?Math.abs(this.x-t.x)<=s&&Math.abs(this.y-t.y)<=s:this.x===t.x&&this.y===t.y}isEqual(t,s,i){return void 0!==i?Math.abs(this.x-t)<=i&&Math.abs(this.y-s)<=i:this.x===t&&this.y===s}equalsPoint2D(t,s){return this.isEqualPoint2D(t,s)}setSub(t,s){this.x=t.x-s.x,this.y=t.y-s.y}addThis(t){return this.x+=t.x,this.y+=t.y,this}setAdd(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}absoluteOther(t){}absolute(){return s(0),this}setNegate(){this.x=-this.x,this.y=-this.y}setNegateOther(t){this.x=-t.x,this.y=-t.y}interpolateThis(t,s){}interpolate(t,i,e){s(0)}scaleAddThis(t,s){this.x=this.x*t+s.x,this.y=this.y*t+s.y}setScaleAdd(t,s,i){this.x=s.x*t+i.x,this.y=s.y*t+i.y}scaleOther(t,i){s(0)}scale(t){this.x*=t,this.y*=t}compare(t){return this.y<t.y?-1:this.y>t.y?1:this.x<t.x?-1:this.x>t.x?1:0}compareX(t){return this.x<t.x?-1:this.x>t.x?1:this.y<t.y?-1:this.y>t.y?1:0}normalizeOther(t){s(0)}normalize(){const t=this.length();return t?(this.x/=t,this.y/=t):(this.x=1,this.y=0),this}getUnitVector(){return this.clone().normalize()}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}sqrLength(){return this.x*this.x+this.y*this.y}static averageFast(t,i){return s(0),{}}static average(t,s){const i=new ei;if(0===s)return i.setNAN(),i;if(1===s)return i.assign(t[0]),i;const e=new n(t[0].x),r=new n(t[0].y);for(let n=1;n<s;n++)e.add(t[n].x),r.add(t[n].y),255&n||(e.normalize(),r.normalize());return i.x=e.getResult()/s,i.y=r.getResult()/s,i}static calculateLength(t,s){const i=new n(0);for(let e=1;e<s;e++)i.add(ei.distance(t[e],t[e-1]));return i.getResult()}offset(t,s){const i=ei.distance(t,s),e=ei.construct(this.x,this.y);if(0===i)return ei.distance(e,t);const n=s.clone();n.subThis(t),e.subThis(t);return e.crossProduct(n)/i}side(t,s){return t.equals(s)?this.equals(t)?0:1:ei.orientationRobust(s,t,this)}static sqrDistance(t,s){const i=t.x-s.x,e=t.y-s.y;return i*i+e*e}static sqrDistanceCoords(t,s,i,e){const n=i-t,r=e-s;return n*n+r*r}static distance(t,s){return Math.sqrt(ei.sqrDistance(t,s))}dotProduct(t){return this.x*t.x+this.y*t.y}dotProductAbs(t){return Math.abs(this.x*t.x)+Math.abs(this.y*t.y)}crossProduct(t){return this.x*t.y-this.y*t.x}crossProductAbs(t){return s(0),0}rotateDirect(t,s){const i=this.x*t-this.y*s,e=this.x*s+this.y*t;this.x=i,this.y=e}rotateReverse(t,s){const i=this.x*t+this.y*s,e=-this.x*s+this.y*t;this.x=i,this.y=e}leftPerpendicularThis(){const t=this.x;this.x=-this.y,this.y=t}leftPerpendicularOther(t){const s=t.x;this.x=-t.y,this.y=s}rightPerpendicularThis(){const t=this.x;this.x=this.y,this.y=-t}rightPerpendicularOther(t){const s=t.x;this.x=t.y,this.y=-s}equals(t){return this.x===t.x&&this.y===t.y}notequals(t){return this.x!==t.x||this.y!==t.y}not(){return!this.x&&!this.y}gt(t){return this.y>t.y||this.y===t.y&&this.x>t.x}gte(t){return!this.lt(t)}lt(t){return this.y<t.y||this.y===t.y&&this.x<t.x}lte(t){return!this.gt(t)}subThis(t){return this.x-=t.x,this.y-=t.y,this}divThis(t){return this.x/=t,this.y/=t,this}add(t){return new ei(this.x+t.x,this.y+t.y)}sub(t){return new ei(this.x-t.x,this.y-t.y)}negateThis(){return this.x=-this.x,this.y=-this.y,this}negate(){return new ei(-this.x,-this.y)}mul(t){return new ei(this.x*t,this.y*t)}mulThis(t){return this.x*=t,this.y*=t,this}divide(t){return new ei(this.x/t,this.y/t)}setNAN(){this.x=this.y=Number.NaN}isNAN(){return Number.isNaN(this.x)||Number.isNaN(this.y)}static getNAN(){return new ei(Number.NaN,Number.NaN)}isFinite(){return Number.isFinite(this.x)&&Number.isFinite(this.y)}isZero(){return 0===this.x&&0===this.y}norm(t){switch(t){case 0:{const t=Math.abs(this.x),s=Math.abs(this.y),i=t-s;return i>=0?t:i<=0?s:Number.NaN}case 1:return Math.abs(this.x)+Math.abs(this.y);case 2:return Math.sqrt(this.x*this.x+this.y*this.y);default:e("norm")}}getQuarter(){return ei.getQuarterCoords(this.x,this.y)}static getQuarterCoords(t,s){return t>0?s>=0?1:4:s>0?2:0===t?4:3}static compareVectors(t,s){const i=t.getQuarter(),e=s.getQuarter();return e===i?ei.orientationRobustImpl(ei.construct(0,0),s,t,!0):i<e?-1:1}static compareVectorsOrigin(t,s,i){const e=s.sub(t),n=i.sub(t),r=e.getQuarter(),u=n.getQuarter();return u===r?ei.orientationRobustImpl(t,i,s,!0):r<u?-1:1}static orientationRobust(t,s,i){return ei.orientationRobustImpl(t,s,i,!1)}static orientationRobustEx(t,s,i,e){if(t.equals(s)||i.equals(e))return 0;const n=s.x-t.x,r=s.y-t.y,u=e.x-i.x,h=e.y-i.y;{const t=ei.getQuarterCoords(n,r)-1,s=ei.getQuarterCoords(u,h)-1,i=ei.d[t][s];if(0!==i)return i}const a=n*h,o=r*u,m=4*Ss()*(Math.abs(a)+Math.abs(o)),l=a-o;if(Math.abs(l)>=m){return l<0?-1:l>0?1:0}return ei.orientationRobustExMp(t,s,i,e)}static orientationRobustExMp(t,s,i,e){const n=Hs.constructDouble(s.x),r=Hs.constructDouble(e.x);n.subThis(Hs.constructDouble(t.x)),r.subThis(Hs.constructDouble(i.x));const u=Hs.constructDouble(s.y),h=Hs.constructDouble(e.y);return u.subThis(Hs.constructDouble(t.y)),h.subThis(Hs.constructDouble(i.y)),n.mulThis(h),u.mulThis(r),n.subThis(u),n.LZ()?-1:n.GZ()?1:0}static orientationNonRobust(t,s,i){const e=s.sub(t).crossProduct(i.sub(t));return e<0?-1:e>0?1:0}static orientationRobustImpl(t,s,i,e){if(s.isEqualPoint2D(t)||i.isEqualPoint2D(t)||s.isEqualPoint2D(i))return 0;const n=s.x-t.x,r=s.y-t.y,u=i.x-t.x,h=i.y-t.y;if(!e){const t=ei.getQuarterCoords(n,r)-1,s=ei.getQuarterCoords(u,h)-1,i=ei.d[t][s];if(0!==i)return i}const a=(Math.abs(n)+Math.abs(r)+Math.abs(u)+Math.abs(h))*(Math.abs(s.x)+Math.abs(s.y)+Math.abs(i.x)+Math.abs(i.y))*8*M(),o=n*h-r*u;if(Math.abs(o)>a){return o<0?-1:1}if(g(s.x,t.x)&&g(i.y,t.y)&&g(s.y,t.y)&&g(i.x,t.x)&&y(n,h)&&y(r,u)){const t=n*h,s=r*u;if(g(t,s)){const i=t-s;return i<0?-1:i>0?1:0}}return ei.orientationRobustMp(t,s,i)}static orientationRobustMp(t,s,i){const e=Hs.constructDouble(s.x),n=Hs.constructDouble(i.x);{const s=Hs.constructDouble(t.x);e.subThis(s),n.subThis(s)}const r=Hs.constructDouble(i.y),u=Hs.constructDouble(s.y);{const s=Hs.constructDouble(t.y);r.subThis(s),u.subThis(s)}return e.mulThis(r),u.mulThis(n),e.subThis(u),e.LZ()?-1:e.GZ()?1:0}static inCircleRobust(t,s,i,e){const n=new p,r=new p;n.set(t.x),n.subThis(e.x),r.set(t.y),r.subThis(e.y);const u=new p,h=new p;u.set(s.x),u.subThis(e.x),h.set(s.y),h.subThis(e.y);const a=new p,o=new p;a.set(i.x),a.subThis(e.x),o.set(i.y),o.subThis(e.y);const m=n.mulE(h).subE(r.mulE(u)),l=u.mulE(o).subE(h.mulE(a)),c=n.mulE(o).subE(r.mulE(a)),f=n.mulE(n).addE(r.mulE(r)),_=u.mulE(u).addE(h.mulE(h)),v=a.mulE(a).addE(o.mulE(o)),b=f.mulE(l).subE(_.mulE(c)).addE(v.mulE(m));if(!b.isFuzzyZero()){const t=b.value();return t<0?-1:t>0?1:0}return ei.inCircleRobustMp(t,s,i,e)}static inCircleRobustMp(t,s,i,e){do{if(!g(t.x,e.x)||!g(t.y,e.y))break;if(!g(s.x,e.x)||!g(s.y,e.y))break;if(!g(i.x,e.x)||!g(i.y,e.y))break;const n=t.x-e.x,r=t.y-e.y,u=s.x-e.x,h=s.y-e.y,a=i.x-e.x,o=i.y-e.y;if(!y(n,h)||!y(r,u))break;if(!y(u,o)||!y(h,a))break;if(!y(n,o)||!y(r,a))break;if(!y(n,n)||!y(r,r))break;if(!y(u,u)||!y(h,h))break;if(!y(a,a)||!y(o,o))break;const m=n*h,l=r*u,c=u*o,f=h*a,_=n*o,v=r*a,b=n*n,d=r*r,x=u*u,N=h*h,p=a*a,M=o*o;if(!g(m,l))break;if(!g(c,f))break;if(!g(_,v))break;if(!T(b,d))break;if(!T(x,N))break;if(!T(p,M))break;const E=m-l,I=c-f,w=_-v,D=b+d,A=x+N,P=p+M;if(!y(D,I))break;if(!y(A,w))break;if(!y(P,E))break;const q=D*I,z=A*w,Z=P*E;if(!g(q,z))break;const C=q-z;if(!T(C,Z))break;const R=C+Z;return R<0?-1:R>0?1:0}while(0);const n=Hs.constructDouble(e.x),r=Hs.constructDouble(e.y),u=Hs.constructDouble(t.x),h=Hs.constructDouble(t.y);u.subThis(n),h.subThis(r);const a=Hs.constructDouble(s.x),o=Hs.constructDouble(s.y);a.subThis(n),o.subThis(r);const m=Hs.constructDouble(i.x),l=Hs.constructDouble(i.y);m.subThis(n),l.subThis(r);const c=u.mul(o).sub(h.mul(a)),f=a.mul(l).sub(o.mul(m)),_=u.mul(l).sub(h.mul(m)),v=u.mul(u).add(h.mul(h)),b=a.mul(a).add(o.mul(o)),d=m.mul(m).add(l.mul(l)),x=v.mul(f).sub(b.mul(_)).add(d.mul(c));return x.LZ()?-1:x.GZ()?1:0}static inCircleRobustMp3Point(t,s,i){const e=Hs.constructDouble(t.x),n=Hs.constructDouble(t.y),r=Hs.constructDouble(s.x),u=Hs.constructDouble(s.y),h=Hs.constructDouble(i.x),a=Hs.constructDouble(i.y),o=h.mul(h).add(a.mul(a)).sub(h.mul(e).add(a.mul(n)).add(h.mul(r)).add(a.mul(u))).add(e.mul(r).add(n.mul(u)));return o.LZ()?-1:o.GZ()?1:0}static inCircleRobust3Point(t,s,i){const e=new p(t.x),n=new p(t.y),r=new p(s.x),u=new p(s.y),h=new p(i.x),a=new p(i.y),o=h.mulE(h).addE(a.mulE(a)).subE(h.mulE(e).addE(a.mulE(n)).addE(h.mulE(r)).addE(a.mulE(u))).addE(e.mulE(r).addE(n.mulE(u)));if(!o.isFuzzyZero()){const t=o.value();return t<0?-1:t>0?1:0}return ei.inCircleRobustMp3Point(t,s,i)}static calculateCircleCenterFromThreePoints(t,s,i){if(t.equals(i)||t.equals(s)||i.equals(s))return ei.getNAN();const e=ni(t,s,i);return e.isNAN()?ri(t,s,i):e}static calculateAngle(t,s){return Math.atan2(t.crossProduct(s),t.dotProduct(s))}static isBisectorRobust(t,i,e){return s(0),!1}static size(){return 2}get 0(){return this.x}get 1(){return this.y}set 0(t){this.x=t}set 1(t){this.y=t}static compareZorder(t,s){const i=ei.c_compare_zorder_xx[t.x<0?1:0]|ei.c_compare_zorder_yy[t.y<0?1:0],e=ei.c_compare_zorder_xx[s.x<0?1:0]|ei.c_compare_zorder_yy[s.y<0?1:0];if(i===e){let i=0,e=0;for(let n=0;n<2;++n){const r=Ks(t[n],s[n]);r>i&&(i=r,e=n)}return t[e]<s[e]}return i<e}static lerp(t,s,i){const e=new ei;return Y(t,s,i,e),e}static getClosestCoordinate(t,s,i,e=!1){const n=ei.getNAN();n.setSub(s,t);const r=n.sqrLength();if(0===r)return.5;if(s.isEqualPoint2D(i))return 1;const u=ei.getNAN();u.setSub(i,t);let h=u.dotProduct(n)/r;return e||(h<0?h=0:h>1&&(h=1)),h}static intersectLinesAtOnePoint(t,s,i,e){if(t.equals(s)||i.equals(e))return ei.getNAN();const n=s.x-t.x,r=i.x-e.x,u=s.y-t.y,h=i.y-e.y,a=n*h-r*u;if(!a)return ei.getNAN();const o=a;if(0===o)return ei.getNAN();let m=(i.x-t.x)*h-(i.y-t.y)*r;m/=o;const l=new ei;return Y(t,s,m,l),l.isFinite()?l:ei.getNAN()}toString(){return`[${this.x},${this.y}]`}}function ni(t,s,i){const e=new p(s.x);e.subThis(t.x);const n=new p(s.y);n.subThis(t.y);const r=new p(i.x);r.subThis(t.x);const u=new p(i.y);u.subThis(t.y);const h=e.clone();h.mulThisE(u);let a=n.clone();if(a.mulThisE(r),h.subThisE(a),0===h.value())return ei.getNAN();h.mulThis(2);const o=e.clone();o.mulThisE(e);const m=n.clone();m.mulThisE(n);const l=o.clone();l.addThisE(m);const c=r.clone();c.mulThisE(r);const f=u.clone();f.mulThisE(u);const _=c.clone();_.addThisE(f);const v=n.clone();v.mulThisE(_),a=u.clone(),a.mulThisE(l),v.subThisE(a),v.divThisE(h);const b=e.clone();b.mulThisE(_),a=r.clone(),a.mulThisE(l),b.subThisE(a),b.divThisE(h);const d=ei.construct(t.x-v.value(),t.y+b.value()),x=t.sub(d).length(),N=s.sub(d).length(),y=i.sub(d).length(),T=1e-15*(x+Math.abs(t.x)+Math.abs(s.x)+Math.abs(i.x)+Math.abs(t.y)+Math.abs(s.y)+Math.abs(i.y));return Math.abs(x-N)<=T&&Math.abs(x-y)<=T&&v.eps()<T&&b.eps()<T?d:ei.getNAN()}function ri(t,s,i){const e=Hs.constructDouble(s.x);e.subDoubleThis(t.x);const n=Hs.constructDouble(s.y);n.subDoubleThis(t.y);const r=Hs.constructDouble(i.x);r.subDoubleThis(t.x);const u=Hs.constructDouble(i.y);u.subDoubleThis(t.y);const h=e.clone();h.mulThis(u);let a=n.clone();if(a.mulThis(r),h.subThis(a),h.isZero())return ei.getNAN();h.mulDoubleThis(2);const o=e.clone();o.mulThis(e);const m=n.clone();m.mulThis(n);const l=o.clone();l.addThis(m);const c=r.clone();c.mulThis(r);const f=u.clone();f.mulThis(u);const _=c.clone();_.addThis(f);const v=n.clone();v.mulThis(_),a=u.clone(),a.mulThis(l),v.subThis(a),v.divThis(h);const b=e.clone();b.mulThis(_),a=r.clone(),a.mulThis(l),b.subThis(a),b.divThis(h);return ei.construct(t.x-v.value(),t.y+b.value())}ei.dimensions=2,ei.d=[[0,1,0,-1],[-1,0,1,0],[0,-1,0,1],[1,0,-1,0]],ei.c_compare_zorder_xx=[2,0],ei.c_compare_zorder_yy=[1,0];export{P as $,qs as A,yt as B,wt as C,Bs as D,x as E,p as F,w as G,I as H,us as I,Fs as J,n as K,St as L,Hs as M,Ss as N,Ot as O,ei as P,V as Q,U as R,Gt as S,pt as T,It as U,F as V,k as W,Dt as X,hs as Y,Y as Z,A as _,Tt as a,L as a0,O as a1,G as a2,rs as a3,Vt as a4,Gs as a5,Ys as a6,Vs as a7,Qs as a8,_t as a9,qt as aA,ii as aB,R as aC,Ms as aD,ms as aE,Kt as aF,Is as aG,Es as aH,vt as aa,jt as ab,Ct as ac,D as ad,Xs as ae,Ws as af,H as ag,Os as ah,ft as ai,st as aj,W as ak,js as al,At as am,Rs as an,cs as ao,gt as ap,gs as aq,ws as ar,Ft as as,Ps as at,Bt as au,S as av,Ts as aw,Ls as ax,si as ay,ti as az,Mt as b,ks as c,Lt as d,X as e,B as f,Cs as g,zt as h,ls as i,os as j,Ut as k,Yt as l,Rt as m,Qt as n,ct as o,kt as p,Q as q,as as r,$ as s,J as t,Pt as u,Et as v,Zt as w,j as x,z as y,C as z};
|
|
5
|
+
import{b as t,g as s,n as i,t as e}from"./Geometry.js";class n{constructor(t){this.sum=t,this.compensation=0}assign(t){return this.compensation=t.compensation,this.sum=t.sum,this}reset(){this.sum=this.compensation=0}resetToStart(t){this.sum=t,this.compensation=0}normalize(){const t=[Number.NaN];this.sum=lt(this.sum,this.compensation,t),this.compensation=t[0]}add(t){const s=this.sum+t;let i;if(Math.abs(this.sum)>=Math.abs(t)){const e=this.sum-s+t;i=this.compensation+e}else{const e=t-s+this.sum;i=this.compensation+e}this.sum=s,this.compensation=i}sub(t){this.add(-t)}addProduct(t,s){const i=[0],e=ut(t,s,i);this.add(e),this.add(i[0])}mul(t){const s=new n(0);s.addProduct(this.sum,t),s.addProduct(this.compensation,t),this.assign(s)}getResult(){return this.sum+this.compensation}pe(t){return this.add(t),this}me(t){return this.add(-t),this}}const r=0x00000000ffffffffn,u=0x0000ffffn,h=0x000000ffn,a=0x0fn,o=0xffff0000n,m=0xff00n,l=0xf0n,c=[5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1],f=[-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3];function _(t){let s=0;return t&u||(s+=16,t>>=16n),t&h||(s+=8,t>>=8n),t&a||(s+=4,t>>=4n),s+c[Number(BigInt.asUintN(4,t))]}function v(t){let s=0;return t&o&&(s+=16,t>>=16n),t&m&&(s+=8,t>>=8n),t&l&&(s+=4,t>>=4n),s+f[Number(BigInt.asUintN(4,t))]+1}function b(t){let s=0;return t&r||(s=32,t>>=32n),s+_(BigInt.asUintN(32,t))}function d(t){let s=0;return 0xffffffff00000000n&t&&(s=32,t>>=32n),s+v(t)}class x{constructor(t,s){if(this.m_EnvelopeType=1,void 0!==t){if(t instanceof x)return this.vmin=t.vmin,void(this.vmax=t.vmax);this.vmin=t,this.vmax=s,this.normalize()}else this.setEmpty()}static construct(t,s){return new x(t,s)}static constructEmpty(){return new x}setCoords(t,s){this.vmin=t,this.vmax=s,this.normalize()}setCoordsFromEnvelope(t){this.vmin=t.vmin,this.vmax=t.vmax}setEmpty(){this.vmin=Number.NaN,this.vmax=Number.NaN}getCenter(){return.5*(this.vmin+this.vmax)}equalsRange(t,s){return rs(this.vmin,t)&&rs(this.vmax,s)}equals(t,s){return!(!this.isEmpty()||!t.isEmpty())||(void 0!==s?Math.abs(this.vmin-t.vmin)<=s&&Math.abs(this.vmax-t.vmax)<=s:this.vmin===t.vmin&&this.vmax===t.vmax)}width(){return this.vmax-this.vmin}isEmpty(){return Number.isNaN(this.vmin)||Number.isNaN(this.vmax)}isZero(){return this.vmin===this.vmax}setInfinite(){this.vmin=Number.NEGATIVE_INFINITY,this.vmax=Number.POSITIVE_INFINITY}move(t){this.isEmpty()||(this.vmin+=t,this.vmax+=t)}contains(t){return t.vmin>=this.vmin&&t.vmax<=this.vmax}containsCoordinate(t){return t>=this.vmin&&t<=this.vmax}containsRightExclusive(t){return t>=this.vmin&&t<this.vmax}containsExclusiveCoordinate(t){return t>this.vmin&&t<this.vmax}containsExclusive(t){return t.vmin>this.vmin&&t.vmax<this.vmax}isIntersecting(t){return this.vmin<=t.vmin?this.vmax>=t.vmin:t.vmax>=this.vmin}mergeCoordinate(t){if(this.isEmpty())return this.vmin=t,void(this.vmax=t);this.mergeNeCoordinate(t)}merge(t){if(t.isEmpty())return;const s=t.vmin,i=t.vmax;this.mergeCoordinate(s),this.mergeCoordinate(i)}mergeNe(t){const s=t.vmin,i=t.vmax;this.mergeNeCoordinate(s),this.mergeNeCoordinate(i)}mergeNeCoordinate(t){t<this.vmin?this.vmin=t:t>this.vmax&&(this.vmax=t)}intersect(t){this.isEmpty()||t.isEmpty()?this.setEmpty():(this.vmin<t.vmin&&(this.vmin=t.vmin),this.vmax>t.vmax&&(this.vmax=t.vmax),this.vmin>this.vmax&&this.setEmpty())}inflate(t){this.isEmpty()||(this.vmin-=t,this.vmax+=t,this.vmax<this.vmin&&this.setEmpty())}normalize(){this.vmin<=this.vmax||(this.vmin>this.vmax?this.vmax=Mt(this.vmin,this.vmin=this.vmax):this.setEmpty())}isValid(){return this.isEmpty()||this.vmin<=this.vmax}snapClip(t){return ks(t,this.vmin,this.vmax)}calculateToleranceFromEnvelope(){if(this.isEmpty())return Cs();return(Math.abs(this.vmin)+Math.abs(this.vmax)+1)*Cs()}static unit(){return N}normalizeNoNAN(){this.vmin>this.vmax&&(this.vmax=Mt(this.vmin,this.vmin=this.vmax))}setCoordsNoNAN(t,s){this.vmin=t,this.vmax=s,this.normalizeNoNAN()}clone(){return new x(this.vmin,this.vmax)}}const N=new x(0,1);class p{static getNAN(){return new p(Number.NaN)}constructor(t,s){this.m_value=t??0,this.m_eps=s??0}[Symbol.toPrimitive](t){return this}clone(){return new p(this.m_value,this.m_eps)}assign(t){return this.m_value=t.m_value,this.m_eps=t.m_eps,this}scaleError(t){this.m_eps*=t}setError(t){this.m_eps=t}set(t,s){return this.m_value=t,this.m_eps=s??0,this}setWithEps(t,s){return void 0===s&&(s=1),this.m_value=t,this.m_eps=p.ulp(t)*s,this}setE(t){return this.m_value=t.m_value,this.m_eps=t.m_eps,this}precise(){return new p(this.m_value)}value(){return this.m_value}toDouble(){return this.m_value}eps(){return this.m_eps}resetError(){return this.m_eps=0,this}absThis(){return this.m_value=Math.abs(this.m_value),this}add(t){return this.clone().addThis(t)}addE(t){return this.clone().addThisE(t)}addThisE(t){const s=this.m_value+t.m_value,i=this.m_eps+t.m_eps+p.ulp(s);return this.m_value=s,this.m_eps=i,this}addThis(t){const s=this.m_value+t,i=this.m_eps+p.ulp(s);return this.m_value=s,this.m_eps=i,this}subE(t){return this.clone().subThisE(t)}sub(t){return this.clone().subThis(t)}subThisE(t){const s=this.m_value-t.m_value,i=this.m_eps+t.m_eps+p.ulp(s);return this.m_value=s,this.m_eps=i,this}subThis(t){const s=this.m_value-t,i=this.m_eps+p.ulp(s);return this.m_value=s,this.m_eps=i,this}setAddE(t,s){return this.m_value=t.m_value+s.m_value,this.m_eps=t.m_eps+s.m_eps+p.ulp(this.m_value),this}setAdd(t,s){return this.m_value=t+s,this.m_eps=p.ulp(this.m_value),this}setAddEN(t,s){return this.m_value=t.m_value+s,this.m_eps=t.m_eps+p.ulp(this.m_value),this}setAddNE(t,s){return this.m_value=t+s.m_value,this.m_eps=s.m_eps+p.ulp(this.m_value),this}setSubE(t,s){return this.m_value=t.m_value-s.m_value,this.m_eps=t.m_eps+s.m_eps+p.ulp(this.m_value),this}setSub(t,s){return this.m_value=t-s,this.m_eps=p.ulp(this.m_value),this}setSubEN(t,s){return this.m_value=t.m_value-s,this.m_eps=t.m_eps+p.ulp(this.m_value),this}setSubNE(t,s){return this.m_value=t-s.m_value,this.m_eps=s.m_eps+p.ulp(this.m_value),this}mulThisE(t){const s=this.m_value*t.m_value;return this.m_eps=this.m_eps*Math.abs(t.m_value)+t.m_eps*Math.abs(this.m_value)+this.m_eps*t.m_eps+p.ulp(s),this.m_value=s,this}mulThis(t){const s=this.m_value*t;return this.m_eps=this.m_eps*Math.abs(t)+p.ulp(s),this.m_value=s,this}mul(t){return this.clone().mulThis(t)}mulE(t){return this.clone().mulThisE(t)}setMulE(t,s){const i=t.m_value*s.m_value;return this.m_eps=t.m_eps*Math.abs(s.m_value)+s.m_eps*Math.abs(t.m_value)+t.m_eps*s.m_eps+p.ulp(i),this.m_value=i,this}setMul(t,s){return this.m_value=t*s,this.m_eps=p.ulp(this.m_value),this}setMulEN(t,s){return this.setE(t),this.mulThis(s)}setMulNE(t,s){return this.setE(s),this.mulThis(t)}mulThisByPower2(t){return this.m_value*=t,this.m_eps*=Math.abs(t),this}static st_mulByPower2(t,s){return new p(t.m_value,t.m_eps).mulThisByPower2(s)}divE(t){return this.clone().divThisE(t)}divThisE(t){const s=Math.abs(t.m_value),i=this.m_value/t.m_value;let e=(this.m_eps+Math.abs(i)*t.m_eps)/s;if(t.m_eps>.01*s){const i=t.m_eps/s;e*=1+(1+i)*i}return this.m_value=i,this.m_eps=e+p.ulp(i),this}divThis(t){const s=Math.abs(t);return this.m_value/=t,this.m_eps=this.m_eps/s+p.ulp(this.m_value),this}setDivE(t,s){return this.setE(t),this.divThisE(s)}setDiv(t,s){return this.m_value=t/s,this.m_eps=p.ulp(this.m_value),this}setDivEN(t,s){return this.setE(t),this.divThis(s)}setDivNE(t,s){return this.set(t),this.divThisE(s)}divThisByPower2(t){return this.m_value/=t,this.m_eps/=Math.abs(t),this}invThis(){return this.setE(w.clone().divThisE(this)),this}sqrt(){return this.clone().sqrtThis()}sqrtThis(){let t,s;return this.m_value>=0?(t=Math.sqrt(this.m_value),s=this.m_value>10*this.m_eps?.5*this.m_eps/t:this.m_value>this.m_eps?t-Math.sqrt(this.m_value-this.m_eps):Math.max(t,Math.sqrt(this.m_value+this.m_eps)-t),s+=p.ulp(t)):this.m_value<-this.m_eps?(t=Number.NaN,s=Number.NaN):(t=0,s=Math.sqrt(this.m_eps)),this.m_value=t,this.m_eps=s,this}sqr(){return this.clone().sqrThis()}sqrThis(){const t=this.m_value*this.m_value;return this.m_eps=2*this.m_eps*Math.abs(this.m_value)+this.m_eps*this.m_eps+p.ulp(t),this.m_value=t,this}setSin(t){const s=Math.sin(t.m_value),i=Math.cos(t.m_value);this.m_value=s;const e=Math.abs(s),n=Math.abs(t.value());return this.m_eps=(Math.abs(i)+.5*e*t.m_eps)*t.m_eps+p.ulp(e+n),this}static ulp(t){let s=ts(t);const i=((0x7ff0000000000000n&s)>>52n)-1075n;return i>-1023n?(s=i+0x3ffn<<52n,ss(s)):0===t?0:Number.MIN_VALUE}setCos(t){const s=Math.sin(t.m_value),i=Math.cos(t.m_value);this.m_value=i;const e=Math.abs(i),n=Math.abs(t.value());return this.m_eps=(Math.abs(s)+.5*e*t.m_eps)*t.m_eps+p.ulp(e+n),this}static st_cosAndSin(t,s,i){const e=Math.sin(t.m_value),n=Math.cos(t.m_value);i.m_value=e,s.m_value=n;const r=Math.abs(e),u=Math.abs(n),h=Math.abs(t.value());i.m_eps=(Math.abs(n)+.5*r*t.m_eps)*t.m_eps+p.ulp(r+h),s.m_eps=(Math.abs(e)+.5*u*t.m_eps)*t.m_eps+p.ulp(u+h)}negate(){return this.clone().negateThis()}negateThis(){return this.m_value=-this.m_value,this}setAbs(){return this.m_value=Math.abs(this.m_value),this}isInInterval(t){return x.construct(this.m_value-this.m_eps,this.m_value+this.m_eps).isIntersecting(t)}eq(t){return Math.abs(this.m_value-t.m_value)<=this.m_eps+t.m_eps}ne(t){return!this.eq(t)}gt(t){return this.m_value-t.m_value>this.m_eps+t.m_eps}lt(t){return t.m_value-this.m_value>this.m_eps+t.m_eps}ge(t){return!this.lt(t)}le(t){return!this.gt(t)}tolEQ(t,s){return Math.abs(this.m_value-t.m_value)<=s||this.eq(t)}tolNE(t,s){return!this.tolEQ(t,s)}tolGT(t,s){return this.m_value-t.m_value>s&&this.gt(t)}tolLT(t,s){return t.m_value-this.m_value>s&&this.lt(t)}tolGE(t,s){return!this.tolLT(t,s)}tolLE(t,s){return!this.tolGT(t,s)}isZero(){return Math.abs(this.m_value)<=this.m_eps}isFuzzyZero(){return this.isZero()&&0!==this.m_eps}tolIsZero(t){return Math.abs(this.m_value)<=Math.max(this.m_eps,t)}setPi(){this.setE(E)}setEuler(){this.set(2.718281828459045,M())}static size(){return 1}}function y(t,s){const i=is(t),e=is(s),n=53-b(i),r=53-b(e);return(n>=0?n:0)+(r>=0?r:0)<=52}function T(t,s){const i=t+s;return i-t===s&&i-s===t}function g(t,s){const i=t-s;return t-i===s&&s+i===t}function M(){return Ss()}p.dimensions=1;const E=new p(Math.PI,.5*M()),I=new p(0,0),w=new p(1,0),D=new p(4,0);function A(t,s,i){return t.addE(s.subE(t).mulE(i))}function P(t,s,i){return s.subE(s.subE(t).mulE(w.subE(i)))}function q(t){return Math.atanh(t)}function z(t){let s;if(0===t)s=1;else if(Math.abs(t)>.01)s=q(t)/t;else{let i;const e=-36.841361487904734;s=0;const n=t*t;for(let t=2*Math.trunc(e/Math.log(n)+2.5)-1;t>1;t-=2)i=1/t,s=(s+i)*n;s+=1}return s}function Z(t){const s=Math.PI*Math.PI/6;let i;if(1===t)i=s;else if(t>1)i=s;else if(0===t)i=t;else if(t<0){const s=1+(t=Math.abs(t)),e=Math.log(s);i=e*e/-2-Z(t/s)}else if(t>.5){const e=1-t,n=Math.log(t)*Math.log(e);i=s-Z(e)-n}else{i=0;const s=1+Math.trunc(-16*Math.log(10)/Math.log(t)+1.5);let e=s;for(let n=s;n>0;n--,e-=1)i*=t,i+=1/(e*e);i*=t}return i}function C(t,s){const i=s*t;if(Math.abs(s)<.1){let s=0;for(let t=60;t>=1;t--)s*=i,s+=1/t/t;return s*=t,s}return Z(i)/s}function R(t,s){return t<s?Qt(t,s):Qt(s,t)}function B(t,s){const i=Math.abs(t);return s>=0?i:-i}function S(t){return Math.round(t)}function F(t,s,i,e,n){n[0]=s[0]+(i[0]-s[0])*e,n[1]=s[1]+(i[1]-s[1])*e,3===t&&(n[2]=s[2]+(i[2]-s[2])*e)}function k(t,s,i,e,n){n[0]=i[0]-(i[0]-s[0])*(1-e),n[1]=i[1]-(i[1]-s[1])*(1-e),3===t&&(n[2]=i[2]-(i[2]-s[2])*(1-e))}function L(t,s,i,e,n){e<=.5?F(t,s,i,e,n):k(t,s,i,e,n)}function O(t,s,i,e,n){n[0]=s[0].addE(i[0].subE(s[0]).mulE(e)),n[1]=s[1].addE(i[1].subE(s[1]).mulE(e))}function G(t,s,i,e,n){n[0]=i[0].subE(i[0].subE(s[0]).mulE(w.subE(e))),n[1]=i[1].subE(i[1].subE(s[1]).mulE(w.subE(e)))}function Q(t,s,i){let e;return e=i<=.5?t+(s-t)*i:s-(s-t)*(1-i),e}function V(t,s,i){return t+(s-t)*i}function U(t,s,i){return s-(s-t)*(1-i)}function Y(t,s,i,e){i<=.5?(e.x=t.x+(s.x-t.x)*i,e.y=t.y+(s.y-t.y)*i):(e.x=s.x-(s.x-t.x)*(1-i),e.y=s.y-(s.y-t.y)*(1-i))}function j(t,s,i,e){i<=.5?(e.x=t.x+(s.x-t.x)*i,e.y=t.y+(s.y-t.y)*i,e.z=t.z+(s.z-t.z)*i):(e.x=s.x-(s.x-t.x)*(1-i),e.y=s.y-(s.y-t.y)*(1-i),e.z=s.z-(s.z-t.z)*(1-i))}function $(t){return t*t}function H(t){return t*t*t}function W(t){return 1/Math.sqrt(t)}function X(t){return t<0?-1:t>0?1:0}function J(t,s,i,e){const n=[0],r=[0],u=[0];return lt(ut(t,i,n),ut(s,e,r),u)+(n[0]+r[0]+u[0])}const K=[0],tt=[0];function st(t,s,i){return mt(ut(t,s,K),i,K[0],tt)}const it=[0],et=[0],nt=[0],rt=[0];function ut(t,s,i){const e=t*s;return ht(t,it,et),ht(s,nt,rt),i[0]=et[0]*rt[0]-(e-it[0]*nt[0]-et[0]*nt[0]-it[0]*rt[0]),e}function ht(t,s,i){const e=134217729*t;s[0]=e-(e-t),i[0]=t-s[0]}const at=[0],ot=[0];function mt(t,s,i,e){const n=lt(t,s,at),r=lt(n,i,ot);return lt(r,at[0]+ot[0],e)}function lt(t,s,i){const e=t+s;return Math.abs(t)>Math.abs(s)?i[0]=t-e+s:i[0]=s-e+t,e}function ct(t,s){return t%s}function ft(t){const s=1-t;if(0===s)return 1;let i;if(s<=.01){const t=s,e=Math.log(t);i=1+t*(.4431471805599453-.25*e+t*(.05680519270997949-.09375*e+t*(.02183137044373718-.05859375*e+t*(.011544521417308362-.042724609375*e+t*(.00714200031339596-.0336456298828125*e+t*(.004854743337164948-.027757644653320312*e+t*(.003514687963781376-.023627042770385742*e)))))))}else{if(t<.016){const s=t,i=.25,e=.046875,n=.01953125,r=.01068115234375,u=.0067291259765625,h=.004626274108886719,a=.0033752918243408203,o=.0025710230693221092;return Vs()*(1-s*(i+s*(e+s*(n+s*(r+s*(u+s*(h+s*(a+s*o))))))))}i=bt(0,s,1)-t*dt(0,s,1)/3}return ks(i,1,Vs())}function _t(t,i,e=Number.NaN){if(s(i>=0&&i<=1),0===i)return t;let n=1,r=t;if(r<0&&(r=-r,n=-1),1===i){const t=Math.round(r/Gs()),s=r-t*Gs();return n*(2*t+Math.sin(s))}const u=Vs(),h=Math.floor(r/u);1&h?r=(h+1)*u-r:r-=h*u;const a=Math.sin(r),o=Number.isNaN(e)?ft(i):e;let m;if(1===a)m=o+Math.sqrt(1-i)*(r-u);else{const t=r*r;if(.01424*Math.pow(t,4)<=2*Ss()){m=r*(1+t*i*(-1/6+t*((4-3*i)/120-(16+(45*i-60)*i)/5040*t)))}else if(i<=.01){const t=Math.sin(2*r),s=Math.sin(4*r),e=Math.sin(6*r),n=Math.sin(8*r),u=Math.sin(10*r);m=r+i*((2*-r+t)/8+i*((-3*r+2*t-.25*s)/64+i*((-20*r+15*t-3*s+e/3)/1024+i*(5*(-140*r+112*t-28*s+16/3*e-.5*n)/65536+7*i*((-63*r+52.5*t-15*s+3.75*e-.625*n+.05*u)/65536+i*(-693*r+594*t-185.625*s+1.375*e-12.375*n+1.8*u-.125*Math.sin(12*r))/1048576)))))}else{const t=a*a,s=Math.cos(r),e=s*s,n=xt(a,s,i);m=a*(bt(e,n,1)-i*t*dt(e,n,1)/3)}}if(1&h){m=o*(h+1)-m}else m+=o*h;return n*m}function vt(t,s,i=Number.NaN){if(0===t)return 0;let e=1,n=t;t<0&&(n=-n,e=-1);const r=Number.isNaN(i)?ft(s):i,u=Math.floor(n/r);1&u?n=(u+1)*r-n:n-=u*r;let h=n<=0?0:n>=r?Vs():Nt(n,s,r);return 1&u?h=Vs()*(u+1)-h:h+=Vs()*u,e*h}function bt(t,i,e){s((0!==t?1:0)+(0!==i?1:0)+1>1);let n=t,r=i,u=e;for(;;){const t=Math.sqrt(n*r)+Math.sqrt(r*u)+Math.sqrt(u*n);n=.25*(n+t),r=.25*(r+t),u=.25*(u+t);const s=(n+r+u)/3,i=(s-n)/s,e=(s-r)/s,h=(s-u)/s;if(Math.abs(i)<=.0024&&Math.abs(e)<=.0024&&Math.abs(h)<=.0024){const t=i*e-h*h,n=i*e*h;return(1+(1/24*t-.1-3/44*n-5*t*t/208+t*n/16)*t+(1/14+3*n/104)*n)/Math.sqrt(s)}}}function dt(t,i,e){s(0!==t||0!==i);let r=t,u=i,h=e;const a=new n(0);let o=1;for(;;){const t=.2*(r+u+3*h),s=(t-r)/t,i=(t-u)/t,e=(t-h)/t;if(Math.abs(s)<=.0015&&Math.abs(i)<=.0015&&Math.abs(e)<=.0015){const n=s*i,r=e*e,u=n-r,h=n-6*r,m=h+u+u,l=3/26,c=h*(.25*(9/22)*h-.21428571428571427-1.5*l*e*m),f=e*(1/6*m+e*(-.4090909090909091*u+e*l*n));return 3*a.getResult()+o*(1+c+f)/(t*Math.sqrt(t))}const n=Math.sqrt(r),m=Math.sqrt(u),l=Math.sqrt(h),c=n*(m+l)+m*l;a.add(o/(l*(h+c))),o*=.25,r=.25*(r+c),u=.25*(u+c),h=.25*(h+c)}}function xt(t,s,i){return t<.999?1-i*$(t):1-i+i*$(s)}function Nt(t,s,i){if(0===s)return t;if(1===s)return Math.asin(t);let e=0,n=!0;if(t<.2){const i=t*t,r=t*(1+i*s*(1/6+i*((13*s-4)/120+(16-284*s+493*s*s)/5040*i))),u=Math.abs(s*(4944*s-64-31224*s*s+37369*s*s*s)/362880*Math.pow(t,9));if(u<Math.abs(r)*Ss())return r;e=r,n=u>.1*r}if(n){const n=1-s,r=1-t/i,u=Math.sqrt(r*r+n*n),h=Math.atan2(n,t+Ss());e=Vs()+Math.sqrt(u)*(h-Vs())}let r=0;for(let u=0;u<7;u++){r=_t(e,s,i);const n=xt(Math.sin(e),Math.cos(e),s);if(e-=(r-t)/Math.sqrt(n),u>0&&Math.abs(r-t)<=4*Ss()*t)break}return e}function pt(s,i,e,n,r){return 0===s?0===n?i:1===n?e:r:1===s?0===n?i:1===n?e:Q(i,e,n):(2===s&&t("angular interpolation"),void t(""))}function yt(s,i,e,n,r,u,h,a){if(0===s)for(let t=0;t<u;++t)n[t+r]=0===h?i[t]:1===h?e[t]:a;else if(1===s)if(0===h)Tt(n,i,r,0,u);else if(1===h)Tt(n,e,r,0,u);else for(let t=0;t<u;++t)n[t+r]=Q(i[t],e[t],h);else if(2===s)if(0===h)Tt(n,i,r,0,u);else if(1===h)Tt(n,e,r,0,u);else{let t=0;for(let s=0,a=r;s<u;++s,++a)n[a]=Q(i[s],e[s],h),t+=n[a]*n[a];if(t>0){t=Math.sqrt(t);for(let s=r;s<r+u;++s)n[s]/=t}else{for(let t=r;t<r+u;++t)n[t]=0;n[r]=1}}else t("")}function Tt(t,s,i,e,n){if(0===n)return;let r=0,u=i,h=e;for(;r++<n;)t[u++]=s[h++]}function gt(t,s,i){let e=0;for(let n=0;!e&&n<i;++n)e=t[n]-s[n];return e}function Mt(t,s){return t}function Et(t){t.sort(((t,s)=>t<s?-1:t>s?1:0))}function It(t,s){const i=t.slice(0,s);Et(i),Tt(t,i,0,0,s)}function wt(t,s,i,e){const n=t.slice(s,s+i);n.sort(e),Tt(t,n,s,0,i)}function Dt(t,s){return t<s?-1:t>s?1:0}function At(t,s,i,e){return t<i?-1:t>i?1:s<e?-1:s>e?1:0}function Pt(t,s){if(t.length<2)return t.length;let i=0;for(let e=1;e<t.length;++e)s(t[e],t[i])||(i++,t[e]=Mt(t[i],t[i]=t[e]));return 1+i}function qt(t,s){t[s]=t.at(-1),t.pop()}function zt(t,s=!1){return{[Symbol.dispose](){this.bForget||t()},bForget:s}}function Zt(t,s,i){t.length=s,t.fill(i)}function Ct(t,s,i){t.length=i;for(let e=0;e<i;++e)t[e]=new s}function Rt(t,s){const i=new Array(s);for(let e=0;e<s;++e)i[e]=new t;return i}function Bt(t,s,i){for(let e=0;e<i;++e)t[e].assign(s[e]);return i}function St(t,s){const i=t.slice(0,s);for(let e=0;e<s;++e)i[e]=i[e].clone();return i}function Ft(t){return Array.from({length:t},(()=>null))}function kt(t,s){return Array.from({length:s},(()=>t()))}function Lt(t,s){const i=new Array(t);return i.fill(s),i}function Ot(t,s){return s in t&&1===Object.getOwnPropertyNames(t).length}class Gt{constructor(...t){this.m_elts=t}get length(){return this.m_elts.length}at(t){return this.m_elts[t]}[Symbol.dispose](){for(const t of this.m_elts)t[Symbol.dispose]()}}function Qt(t,s){return{first:t,second:s}}const Vt=Math.PI,Ut=2*Math.PI,Yt=.5*Math.PI;class jt{constructor(t,s){this.m_cr=t,this.m_cc=s,this.m_v=Lt(t*s,0)}get(t,s){return this.m_v[t*this.m_cc+s]}set(t,s,i){this.m_v[t*this.m_cc+s]=i}inc(t,s){return++this.m_v[t*this.m_cc+s]}}const $t=new ArrayBuffer(8),Ht=new Float64Array($t),Wt=new BigUint64Array($t),Xt=0x0fffffffffffffn,Jt=0x7ff0000000000000n;function Kt(){return Number.EPSILON*Zs}function ts(t){return Ht[0]=t,Wt[0]}function ss(t){return Wt[0]=t,Ht[0]}function is(t){return ts(t)&Xt}function es(t){return Number((ts(t)&Jt)>>52n)}function ns(t){if(0n===t)return-1n;if(1n===t||-1n===t)return 0n;t<0n&&(t=-t);let s=0n,i=512n,e=1n<<s+i;for(;t>=e;)s+=i,i<<=1n,e<<=i;let n=s;i>>=1n;let r=n+i;for(;i>0n;)t<1n<<r||(n=r),i>>=1n,r=n+i;return n}function rs(t,s){return t===s||Number.isNaN(t)&&Number.isNaN(s)}function us(t,s,i){return t===s||Math.abs(t-s)<=i||Number.isNaN(t)&&Number.isNaN(s)}function hs(t,s){return t<s?-1:t>s?1:0}function as(t,s){if(t<s)return-1;if(t>s)return 1;if(t===s)return 0;{const i=Number.isNaN(t),e=Number.isNaN(s);return i<e?-1:i>e?1:0}}function os(){return 2147483647}function ms(){return 32767}function ls(){return 2147483647}function cs(){return-2147483648}const fs=ls(),_s=BigInt(fs),vs=2166136261,bs=16777619;function ds(t){let s=vs,i=t;return s=(s^255&i)*bs,i>>=8,s=(s^255&i)*bs,i>>=8,s=(s^255&i)*bs,i>>=8,s=(s^255&i)*bs,s&fs}const xs=14695981039346656037n,Ns=1099511628211n;function ps(t){let s=xs,i=t;return s=(s^0xffn&i)*Ns,i>>=8n,s=(s^0xffn&i)*Ns,i>>=8n,s=(s^0xffn&i)*Ns,i>>=8n,s=(s^0xffn&i)*Ns,i>>=8n,s=(s^0xffn&i)*Ns,i>>=8n,s=(s^0xffn&i)*Ns,i>>=8n,s=(s^0xffn&i)*Ns,s&_s}function ys(t){return 1103515245*t+12345&2147483647}function Ts(t){let s=vs;for(let i=0,e=t.length;i<e;++i)s=(s^t.charCodeAt(i))*bs;return s&fs}function gs(t,s){return s+2654435769+(t<<6)+(t>>2)&fs}function Ms(t,s){return gs(t,Ds(s))}function Es(t){return gs(3735928559,t)}function Is(t,s){return gs(t,Es(s))}function ws(t){return ds(t)}function Ds(t){return Number(ps(t))}function As(t){return js(t)}function Ps(t){return Ds(ts(As(t)))}function qs(t){return ys(t)}const zs=100,Zs=100;function Cs(){return Number.EPSILON*zs}function Rs(){return.38196601125010515}function Bs(){return 1.4142135623730951}function Ss(){return Number.EPSILON}function Fs(t,s,i){return t===s||t===i}function ks(t,s,i){return t>=s?t<=i?t:i:s}function Ls(t,s,i){const e=t[0];if(e>=s){if(e<=i)return!1;t[0]=i}else t[0]=s;return!0}function Os(t,s){return t>=s?s:t<-s?-s:t}function Gs(){return Vt}function Qs(){return Ut}function Vs(){return Yt}const Us=3*Vs();function Ys(){return Us}function js(t){return t+0}function $s(t){return{v:t}}class Hs{constructor(){this.m_rn=$s(0n),this.m_rd=$s(1n),this.m_bNaN=!1,this.m_bNormalized=!1,this.m_power=0,this.m_sign=0}static constructAssign(t,s){const i=t.clone();return void 0!==s&&i.limitPrecisionThis(s),i}static constructDouble(t){return(new Hs).setDouble(t)}static constructInt64(t){return(new Hs).setInt64(t)}static constructRational(t,s){return(new Hs).setRational(t,s)}static constructInt32(t){return this.constructInt64(BigInt(Math.trunc(t)))}[Symbol.toPrimitive](t){return this}compare(t){return this.lt(t)?-1:this.gt(t)?1:0}assignCopy(t){return this.setThis(t)}abs(){return this.clone().absThis()}absThis(){return this.isNAN()||(this.m_sign*=this.m_sign),this}clone(){return(new Hs).setThis(this)}setThis(t){return this.m_bNaN=t.m_bNaN,this.m_bNormalized=t.m_bNormalized,this.m_rn.v=t.m_rn.v,this.m_rd.v=t.m_rd.v,this.m_power=t.m_power,this.m_sign=t.m_sign,this}setZero(){return this.m_rn.v=0n,this.m_rd.v=1n,this.m_bNaN=!1,this.m_power=0,this.m_bNormalized=!0,this.m_sign=0,this}setDouble(s){if(this.setZero(),0===s)return this;if(Number.isInteger(s)&&Math.abs(s)<ls())return this.setInt32(s);const i=ts(s),e=(i&Hs.s_em)>>52n,n=!!(i&Hs.s_sm),r=i&Hs.s_fm;if(e===Hs.s_emax)return r?(this.m_rn.v=this.m_rd.v=0n,this.m_bNaN=!0,this):(this.m_rn.v=n?-1n:1n,this.m_rd.v=0n,this);0n===e&&t("denormalized numbers not yet implemented");const u=e-1023n,h=u>=0n?u:0n,a=u<0n?-u:0n;return this.m_rn.v=(1n<<52n|r)<<h,this.m_rd.v=1n<<52n+a,this.m_sign=n?-1:1,this.m_bNormalized=!1,this.normalizeThis()}setInt64(t){return 0n===t?this.setZero():(this.m_bNaN=!1,this.m_sign=t>0n?1:-1,this.m_rn.v=t>0n?t:-t,this.m_rd.v=1n,this.m_power=0,this.m_bNormalized=!1,this.normalizeThis())}setRational(t,s){return 0n===t?0n===s?this.setNAN():this.setZero():0n===s?t>0n?this.setPositiveInf():this.setNegativeInf():(this.m_sign=(t>0n?1:-1)*(s>0n?1:-1),this.m_rn.v=t>0n?t:-t,this.m_rd.v=s>0n?s:-s,this.m_power=0,this.m_bNormalized=!1,this.normalizeThis())}setInt32(t){return this.setInt64(BigInt(Math.trunc(t)))}getDouble(){return this.convertToDouble()}toDouble(){return this.convertToDouble()}value(){return this.convertToDouble()}isNAN(){return this.m_bNaN}isPositiveInf(){return!this.isNAN()&&(0n===this.m_rd.v&&1===this.m_sign)}isNegativeInf(){return!this.isNAN()&&(0n===this.m_rd.v&&-1===this.m_sign)}isFinite(){return!this.isNAN()&&0n!==this.m_rd.v}setNAN(){return this.m_bNaN=!0,this.m_rn.v=0n,this.m_rd.v=0n,this.m_power=0,this.m_bNormalized=!0,this}setPositiveInf(){return this.m_rn.v=1n,this.m_rd.v=0n,this.m_bNaN=!1,this.m_bNormalized=!0,this.m_sign=1,this.m_power=0,this}setNegativeInf(){return this.m_rn.v=1n,this.m_rd.v=0n,this.m_bNaN=!1,this.m_bNormalized=!0,this.m_sign=-1,this.m_power=0,this}subThis(t){if(t.isNAN()&&this.setNAN(),this.isPositiveInf()&&t.isPositiveInf())this.setNAN();else{if(this.isPositiveInf()&&t.isNegativeInf())return this.setPositiveInf(),this;if(this.isNegativeInf()&&t.isNegativeInf())this.setNAN();else if(this.isNegativeInf()&&t.isPositiveInf())return this.setNegativeInf(),this}return this.isNAN()?this:this.opPlusMinus(t,!1)}thisSubAbs(t){return s(0),this}mulThis(t){return t.isNAN()&&this.setNAN(),this.isNAN()?this:(this.m_sign*=t.m_sign,0===this.m_sign?this.setZero():(this.m_rn.v*=t.m_rn.v,this.m_rd.v*=t.m_rd.v,this.m_power+=t.m_power,this.m_bNormalized=!1,this.normalizeThis(),this))}mulDoubleThis(t){return this.mulThis(Hs.constructDouble(t))}thisMulInt64(t){return s(0),this}thisMulInt32(t){return s(0),this}divThis(t){return this.mulThis(t.clone().invertThis())}divDoubleThis(t){return this.divThis(Hs.constructDouble(t))}addDoubleThis(t){return this.addThis(Hs.constructDouble(t))}subDoubleThis(t){return this.subThis(Hs.constructDouble(t))}mul(t){return this.clone().mulThis(t)}mulBigIntThis(t){return this.mulThis(Hs.constructInt64(t))}mulDouble(t){return this.clone().mulThis(Hs.constructDouble(t))}div(t){return this.clone().divThis(t)}divDouble(t){return this.clone().divDoubleThis(t)}add(t){return this.clone().addThis(t)}fmSubThis(t,s){return this.subThis(t.clone().mulThis(s))}fmAddThis(t,s){return this.addThis(t.clone().mulThis(s))}addThis(t){if(t.isNAN()&&this.setNAN(),this.isPositiveInf()&&t.isPositiveInf())return this.setPositiveInf(),this;if(this.isPositiveInf()&&t.isNegativeInf())this.setNAN();else{if(this.isNegativeInf()&&t.isNegativeInf())return this.setNegativeInf(),this;this.isNegativeInf()&&t.isPositiveInf()&&this.setNAN()}return this.isNAN()?this:this.opPlusMinus(t,!0)}addDouble(t){return this.clone().addThis(Hs.constructDouble(t))}sub(t){return this.clone().subThis(t)}subDouble(t){return this.clone().subThis(Hs.constructDouble(t))}isZero(){return 0===this.m_sign}equals(t){return this.clone().subThis(t).isZero()}lt(t){return!this.isNAN()&&!t.isNAN()&&(!(this.isPositiveInf()&&t.isPositiveInf()||this.isNegativeInf()&&t.isNegativeInf())&&(!this.isPositiveInf()&&(!!t.isPositiveInf()||this.clone().sub(t).LZ())))}absLessAbs(t){return this.abs().lt(t.abs())}gt(t){return this.clone().sub(t).GZ()}lte(t){return this.sub(t).LEZ()}gte(t){return this.sub(t).GEZ()}normalizeThis(){if(this.m_bNormalized)return this;if(0n===this.m_rn.v)return this.setZero();let t=0,s=0xffffffffn;for(;0n===(this.m_rn.v&s)&&s<=this.m_rn.v;)s<<=32n,t+=32;s&=this.m_rn.v,s>>=BigInt(t),t+=_(BigInt.asUintN(32,s))-1;let i=0;for(s=0xffffffffn;0n===(this.m_rd.v&s)&&s<=this.m_rd.v;)s<<=32n,i+=32;return s&=this.m_rd.v,s>>=BigInt(i),i+=_(BigInt.asUintN(32,s))-1,this.m_rn.v>>=BigInt(t),this.m_rd.v>>=BigInt(i),this.m_power+=t-i,this.m_rn.v>1n&&this.m_rd.v>1n&&(this.m_rn.v%this.m_rd.v===0n?(this.m_rn.v/=this.m_rd.v,this.m_rd.v=1n):this.m_rd.v%this.m_rn.v===0n&&(this.m_rd.v/=this.m_rn.v,this.m_rn.v=1n)),this.m_bNormalized=!0,this}negateThis(){return this.isNAN()||(this.m_sign*=-1),this}negate(){return this.clone().negateThis()}invertThis(){return this.isNAN()?this:this.isPositiveInf()||this.isNegativeInf()?(this.setZero(),this):0n===this.m_rn.v?(this.setPositiveInf(),this):(this.m_rd=Mt(this.m_rn,this.m_rn=this.m_rd),this.m_power=-this.m_power,this)}limitPrecisionThis(t){if(0===t)return this;if(this.isZero())return this.setZero();if(!this.isFinite())return this;this.normalizeThis();let s=Number(ns(this.m_rn.v));if(s>t){const i=s-t;this.m_rn.v>>=BigInt(s-t),this.m_power+=i}if(s=Number(ns(this.m_rd.v)),s>t){const i=s-t;this.m_rd.v>>=BigInt(s-t),this.m_power-=i}return this}hiBitIndex(){return Math.max(Number(ns(this.m_rn.v)),Number(ns(this.m_rd.v)))}ldexp(t){return this.clone().ldexpThis(t)}ldexpThis(t){return t&&(this.m_bNormalized=!1,this.m_power+=t,this.normalizeThis()),this}LZ(){return!this.isNAN()&&-1===this.m_sign}GZ(){return!this.isNAN()&&1===this.m_sign}LEZ(){return!this.isNAN()&&this.m_sign<=0}GEZ(){return!this.isNAN()&&this.m_sign>=0}toString(){return this.toDouble().toString()}sqr(){return this.clone().sqrThis()}sqrThis(){return this.mulThis(this.clone())}static sqrt(t,e){if(t.m_sign<0n&&i("MP_value: sqrt(-1)"),t.isZero())return t.clone();let n=52,r=2220446049250313e-31;for(;n<e;)2*n<=e?(r*=r,n*=2):(r*=2220446049250313e-31,n+=52);n+=52;const u=ns(t.m_rn.v),h=ns(t.m_rd.v);let a,o=t.m_power+Number(u-h);const m=new Hs;Math.abs(o)>200?(1&Math.abs(o)&&(o+=1),a=Hs.constructAssign(t,53).ldexpThis(-o).value(),m.setThis(t).ldexpThis(-o),s(Number.isFinite(a))):(m.setThis(t),a=m.value(),s(Number.isFinite(a)),o=0),a=Math.sqrt(a);const l=Hs.constructDouble(a),c=Hs.constructDouble(r);c.mulThis(l).ldexpThis(1);const f=r*a*2,_=l.clone(),v=new Hs;let b;for(let s=0;s<10;++s){_.mulThis(l),v.setThis(m).subThis(_).absThis();let t=v.value();if(b=1,t<.9)for(;t>f;)t*=t,++b;else b=4;if(v.lte(c))break;for(let s=0;s<b;s++)_.setThis(l).divThis(m).invertThis().addThis(l).ldexpThis(-1).limitPrecisionThis(n),l.setThis(_)}return l.ldexpThis(o/2)}static cubicRoot(t,s){if(t.isZero())return t.clone();let i=52,e=2220446049250313e-31;for(;i<s;)2*i<=s?(e*=e,i*=2):(e*=2220446049250313e-31,i+=52);i+=52;const n=Math.pow(Math.abs(t.value()),1/3),r=Hs.constructDouble(n),u=r.clone();u.sqrThis().mulDoubleThis(3).mulDoubleThis(e),u.limitPrecisionThis(32),t.LZ()&&r.negateThis();for(let h=0;h<10;++h){const s=r.clone();s.sqrThis().mulThis(r);const e=s.clone();if(e.subThis(t),e.absThis().limitPrecisionThis(32),e.lte(u))break;e.setThis(t),e.ldexpThis(1),e.addThis(s);const n=s.clone();n.ldexpThis(1),n.addThis(t),e.divThis(n),r.mulThis(e),r.limitPrecisionThis(i)}return r}isInTheRangeOfDouble(){return s(0),!1}sign(){return this.m_sign}cosAndSin(t,i){s(0)}static nan(){return s(0),new Hs}convertToDouble(){if(this.m_bNaN)return Number.NaN;if(this.isZero())return 0;if(0n===this.m_rd.v)return 1===this.m_sign?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;const t=-1===this.m_sign,s=this.m_rn.v<<(this.m_power>=0?BigInt(this.m_power):0n);let i=this.m_rd.v<<(this.m_power<0?BigInt(-this.m_power):0n);const e=s/i;let n=Number(e);if(BigInt(n)!==e)return t?-n:n;let r=s-e*i;if(r){let t=ns(i)-1023n;t>0n&&(i>>=t,r<<=52n,r>>=t);let s=Number(r);Number.isFinite(s)||(r>>=52n,s=Number(r),t=0n),t>0n&&(s/=Math.pow(2,52));n+=s/Number(i)}return t?-n:n}signVal(){return 1===this.m_sign?1n:-1===this.m_sign?-1n:0n}opPlusMinus(t,s){const i=Math.min(this.m_power,t.m_power);let e,n;this.m_power>i?(e=BigInt(this.m_power-i),n=0n):(e=0n,n=BigInt(t.m_power-i));const r=this.signVal()*this.m_rn.v*t.m_rd.v<<e,u=t.signVal()*t.m_rn.v*this.m_rd.v<<n;return this.m_rn.v=s?r+u:r-u,this.m_rd.v*=t.m_rd.v,this.m_power=i,this.m_sign=1,this.m_rn.v<0n&&(this.m_sign=-1,this.m_rn.v=-this.m_rn.v),this.m_bNormalized=!1,this.normalizeThis(),this}}Hs.s_sm=0x8000000000000000n,Hs.s_em=0x7ff0000000000000n,Hs.s_fm=0x000fffffffffffffn,Hs.s_emax=0x7ffn;const Ws=Hs.constructInt32(1),Xs=Hs.constructInt32(0);function Js(t,s){return d(t^s)}function Ks(t,s){let i=es(t);const e=es(s);if(i===e){return i-=53-Js(is(t),is(s)),i}return i>e?i:e}function ti(t,s){for(let i=0,e=0,n=t.length;i<n;i+=2,e++)s[e].x=t[i],s[e].y=t[i+1]}function si(t){const s=new Float64Array(2*t.length);for(let i=0,e=t.length;i<e;++i){const e=i<<1;s[e]=t[i].x,s[e+1]=t[i].y}return s}function ii(t){const s=Rt(ei,t.length);for(let i=0,e=t.length;i<e;++i)s[i].setCoords(t[i][0],t[i][1]);return s}class ei{static construct(t,s){return new ei(t,s)}constructor(t,s){void 0!==t?(this.x=t,this.y=s):this.x=this.y=Number.NaN}clone(){return new ei(this.x,this.y)}assign(t){this.setCoordsPoint2D(t)}setCoords(t,s){return this.x=t,this.y=s,this}setCoordsPoint2D(t){this.x=t.x,this.y=t.y}isEqualPoint2D(t,s){return void 0!==s?Math.abs(this.x-t.x)<=s&&Math.abs(this.y-t.y)<=s:this.x===t.x&&this.y===t.y}isEqual(t,s,i){return void 0!==i?Math.abs(this.x-t)<=i&&Math.abs(this.y-s)<=i:this.x===t&&this.y===s}equalsPoint2D(t,s){return this.isEqualPoint2D(t,s)}setSub(t,s){this.x=t.x-s.x,this.y=t.y-s.y}addThis(t){return this.x+=t.x,this.y+=t.y,this}setAdd(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}absoluteOther(t){}absolute(){return s(0),this}setNegate(){this.x=-this.x,this.y=-this.y}setNegateOther(t){this.x=-t.x,this.y=-t.y}interpolateThis(t,s){}interpolate(t,i,e){s(0)}scaleAddThis(t,s){this.x=this.x*t+s.x,this.y=this.y*t+s.y}setScaleAdd(t,s,i){this.x=s.x*t+i.x,this.y=s.y*t+i.y}scaleOther(t,i){s(0)}scale(t){this.x*=t,this.y*=t}compare(t){return this.y<t.y?-1:this.y>t.y?1:this.x<t.x?-1:this.x>t.x?1:0}compareX(t){return this.x<t.x?-1:this.x>t.x?1:this.y<t.y?-1:this.y>t.y?1:0}normalizeOther(t){s(0)}normalize(){const t=this.length();return t?(this.x/=t,this.y/=t):(this.x=1,this.y=0),this}getUnitVector(){return this.clone().normalize()}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}sqrLength(){return this.x*this.x+this.y*this.y}static averageFast(t,i){return s(0),{}}static average(t,s){const i=new ei;if(0===s)return i.setNAN(),i;if(1===s)return i.assign(t[0]),i;const e=new n(t[0].x),r=new n(t[0].y);for(let n=1;n<s;n++)e.add(t[n].x),r.add(t[n].y),255&n||(e.normalize(),r.normalize());return i.x=e.getResult()/s,i.y=r.getResult()/s,i}static calculateLength(t,s){const i=new n(0);for(let e=1;e<s;e++)i.add(ei.distance(t[e],t[e-1]));return i.getResult()}offset(t,s){const i=ei.distance(t,s),e=ei.construct(this.x,this.y);if(0===i)return ei.distance(e,t);const n=s.clone();n.subThis(t),e.subThis(t);return e.crossProduct(n)/i}side(t,s){return t.equals(s)?this.equals(t)?0:1:ei.orientationRobust(s,t,this)}static sqrDistance(t,s){const i=t.x-s.x,e=t.y-s.y;return i*i+e*e}static sqrDistanceCoords(t,s,i,e){const n=i-t,r=e-s;return n*n+r*r}static distance(t,s){return Math.sqrt(ei.sqrDistance(t,s))}dotProduct(t){return this.x*t.x+this.y*t.y}dotProductAbs(t){return Math.abs(this.x*t.x)+Math.abs(this.y*t.y)}crossProduct(t){return this.x*t.y-this.y*t.x}crossProductAbs(t){return s(0),0}rotateDirect(t,s){const i=this.x*t-this.y*s,e=this.x*s+this.y*t;this.x=i,this.y=e}rotateReverse(t,s){const i=this.x*t+this.y*s,e=-this.x*s+this.y*t;this.x=i,this.y=e}leftPerpendicularThis(){const t=this.x;this.x=-this.y,this.y=t}leftPerpendicularOther(t){const s=t.x;this.x=-t.y,this.y=s}rightPerpendicularThis(){const t=this.x;this.x=this.y,this.y=-t}rightPerpendicularOther(t){const s=t.x;this.x=t.y,this.y=-s}equals(t){return this.x===t.x&&this.y===t.y}notequals(t){return this.x!==t.x||this.y!==t.y}not(){return!this.x&&!this.y}gt(t){return this.y>t.y||this.y===t.y&&this.x>t.x}gte(t){return!this.lt(t)}lt(t){return this.y<t.y||this.y===t.y&&this.x<t.x}lte(t){return!this.gt(t)}subThis(t){return this.x-=t.x,this.y-=t.y,this}divThis(t){return this.x/=t,this.y/=t,this}add(t){return new ei(this.x+t.x,this.y+t.y)}sub(t){return new ei(this.x-t.x,this.y-t.y)}negateThis(){return this.x=-this.x,this.y=-this.y,this}negate(){return new ei(-this.x,-this.y)}mul(t){return new ei(this.x*t,this.y*t)}mulThis(t){return this.x*=t,this.y*=t,this}divide(t){return new ei(this.x/t,this.y/t)}setNAN(){this.x=this.y=Number.NaN}isNAN(){return Number.isNaN(this.x)||Number.isNaN(this.y)}static getNAN(){return new ei(Number.NaN,Number.NaN)}isFinite(){return Number.isFinite(this.x)&&Number.isFinite(this.y)}isZero(){return 0===this.x&&0===this.y}norm(t){switch(t){case 0:{const t=Math.abs(this.x),s=Math.abs(this.y),i=t-s;return i>=0?t:i<=0?s:Number.NaN}case 1:return Math.abs(this.x)+Math.abs(this.y);case 2:return Math.sqrt(this.x*this.x+this.y*this.y);default:e("norm")}}getQuarter(){return ei.getQuarterCoords(this.x,this.y)}static getQuarterCoords(t,s){return t>0?s>=0?1:4:s>0?2:0===t?4:3}static compareVectors(t,s){const i=t.getQuarter(),e=s.getQuarter();return e===i?ei.orientationRobustImpl(ei.construct(0,0),s,t,!0):i<e?-1:1}static compareVectorsOrigin(t,s,i){const e=s.sub(t),n=i.sub(t),r=e.getQuarter(),u=n.getQuarter();return u===r?ei.orientationRobustImpl(t,i,s,!0):r<u?-1:1}static orientationRobust(t,s,i){return ei.orientationRobustImpl(t,s,i,!1)}static orientationRobustEx(t,s,i,e){if(t.equals(s)||i.equals(e))return 0;const n=s.x-t.x,r=s.y-t.y,u=e.x-i.x,h=e.y-i.y;{const t=ei.getQuarterCoords(n,r)-1,s=ei.getQuarterCoords(u,h)-1,i=ei.d[t][s];if(0!==i)return i}const a=n*h,o=r*u,m=4*Ss()*(Math.abs(a)+Math.abs(o)),l=a-o;if(Math.abs(l)>=m){return l<0?-1:l>0?1:0}return ei.orientationRobustExMp(t,s,i,e)}static orientationRobustExMp(t,s,i,e){const n=Hs.constructDouble(s.x),r=Hs.constructDouble(e.x);n.subThis(Hs.constructDouble(t.x)),r.subThis(Hs.constructDouble(i.x));const u=Hs.constructDouble(s.y),h=Hs.constructDouble(e.y);return u.subThis(Hs.constructDouble(t.y)),h.subThis(Hs.constructDouble(i.y)),n.mulThis(h),u.mulThis(r),n.subThis(u),n.LZ()?-1:n.GZ()?1:0}static orientationNonRobust(t,s,i){const e=s.sub(t).crossProduct(i.sub(t));return e<0?-1:e>0?1:0}static orientationRobustImpl(t,s,i,e){if(s.isEqualPoint2D(t)||i.isEqualPoint2D(t)||s.isEqualPoint2D(i))return 0;const n=s.x-t.x,r=s.y-t.y,u=i.x-t.x,h=i.y-t.y;if(!e){const t=ei.getQuarterCoords(n,r)-1,s=ei.getQuarterCoords(u,h)-1,i=ei.d[t][s];if(0!==i)return i}const a=(Math.abs(n)+Math.abs(r)+Math.abs(u)+Math.abs(h))*(Math.abs(s.x)+Math.abs(s.y)+Math.abs(i.x)+Math.abs(i.y))*8*M(),o=n*h-r*u;if(Math.abs(o)>a){return o<0?-1:1}if(g(s.x,t.x)&&g(i.y,t.y)&&g(s.y,t.y)&&g(i.x,t.x)&&y(n,h)&&y(r,u)){const t=n*h,s=r*u;if(g(t,s)){const i=t-s;return i<0?-1:i>0?1:0}}return ei.orientationRobustMp(t,s,i)}static orientationRobustMp(t,s,i){const e=Hs.constructDouble(s.x),n=Hs.constructDouble(i.x);{const s=Hs.constructDouble(t.x);e.subThis(s),n.subThis(s)}const r=Hs.constructDouble(i.y),u=Hs.constructDouble(s.y);{const s=Hs.constructDouble(t.y);r.subThis(s),u.subThis(s)}return e.mulThis(r),u.mulThis(n),e.subThis(u),e.LZ()?-1:e.GZ()?1:0}static inCircleRobust(t,s,i,e){const n=new p,r=new p;n.set(t.x),n.subThis(e.x),r.set(t.y),r.subThis(e.y);const u=new p,h=new p;u.set(s.x),u.subThis(e.x),h.set(s.y),h.subThis(e.y);const a=new p,o=new p;a.set(i.x),a.subThis(e.x),o.set(i.y),o.subThis(e.y);const m=n.mulE(h).subE(r.mulE(u)),l=u.mulE(o).subE(h.mulE(a)),c=n.mulE(o).subE(r.mulE(a)),f=n.mulE(n).addE(r.mulE(r)),_=u.mulE(u).addE(h.mulE(h)),v=a.mulE(a).addE(o.mulE(o)),b=f.mulE(l).subE(_.mulE(c)).addE(v.mulE(m));if(!b.isFuzzyZero()){const t=b.value();return t<0?-1:t>0?1:0}return ei.inCircleRobustMp(t,s,i,e)}static inCircleRobustMp(t,s,i,e){do{if(!g(t.x,e.x)||!g(t.y,e.y))break;if(!g(s.x,e.x)||!g(s.y,e.y))break;if(!g(i.x,e.x)||!g(i.y,e.y))break;const n=t.x-e.x,r=t.y-e.y,u=s.x-e.x,h=s.y-e.y,a=i.x-e.x,o=i.y-e.y;if(!y(n,h)||!y(r,u))break;if(!y(u,o)||!y(h,a))break;if(!y(n,o)||!y(r,a))break;if(!y(n,n)||!y(r,r))break;if(!y(u,u)||!y(h,h))break;if(!y(a,a)||!y(o,o))break;const m=n*h,l=r*u,c=u*o,f=h*a,_=n*o,v=r*a,b=n*n,d=r*r,x=u*u,N=h*h,p=a*a,M=o*o;if(!g(m,l))break;if(!g(c,f))break;if(!g(_,v))break;if(!T(b,d))break;if(!T(x,N))break;if(!T(p,M))break;const E=m-l,I=c-f,w=_-v,D=b+d,A=x+N,P=p+M;if(!y(D,I))break;if(!y(A,w))break;if(!y(P,E))break;const q=D*I,z=A*w,Z=P*E;if(!g(q,z))break;const C=q-z;if(!T(C,Z))break;const R=C+Z;return R<0?-1:R>0?1:0}while(0);const n=Hs.constructDouble(e.x),r=Hs.constructDouble(e.y),u=Hs.constructDouble(t.x),h=Hs.constructDouble(t.y);u.subThis(n),h.subThis(r);const a=Hs.constructDouble(s.x),o=Hs.constructDouble(s.y);a.subThis(n),o.subThis(r);const m=Hs.constructDouble(i.x),l=Hs.constructDouble(i.y);m.subThis(n),l.subThis(r);const c=u.mul(o).sub(h.mul(a)),f=a.mul(l).sub(o.mul(m)),_=u.mul(l).sub(h.mul(m)),v=u.mul(u).add(h.mul(h)),b=a.mul(a).add(o.mul(o)),d=m.mul(m).add(l.mul(l)),x=v.mul(f).sub(b.mul(_)).add(d.mul(c));return x.LZ()?-1:x.GZ()?1:0}static inCircleRobustMp3Point(t,s,i){const e=Hs.constructDouble(t.x),n=Hs.constructDouble(t.y),r=Hs.constructDouble(s.x),u=Hs.constructDouble(s.y),h=Hs.constructDouble(i.x),a=Hs.constructDouble(i.y),o=h.mul(h).add(a.mul(a)).sub(h.mul(e).add(a.mul(n)).add(h.mul(r)).add(a.mul(u))).add(e.mul(r).add(n.mul(u)));return o.LZ()?-1:o.GZ()?1:0}static inCircleRobust3Point(t,s,i){const e=new p(t.x),n=new p(t.y),r=new p(s.x),u=new p(s.y),h=new p(i.x),a=new p(i.y),o=h.mulE(h).addE(a.mulE(a)).subE(h.mulE(e).addE(a.mulE(n)).addE(h.mulE(r)).addE(a.mulE(u))).addE(e.mulE(r).addE(n.mulE(u)));if(!o.isFuzzyZero()){const t=o.value();return t<0?-1:t>0?1:0}return ei.inCircleRobustMp3Point(t,s,i)}static calculateCircleCenterFromThreePoints(t,s,i){if(t.equals(i)||t.equals(s)||i.equals(s))return ei.getNAN();const e=ni(t,s,i);return e.isNAN()?ri(t,s,i):e}static calculateAngle(t,s){return Math.atan2(t.crossProduct(s),t.dotProduct(s))}static isBisectorRobust(t,i,e){return s(0),!1}static size(){return 2}get 0(){return this.x}get 1(){return this.y}set 0(t){this.x=t}set 1(t){this.y=t}static compareZorder(t,s){const i=ei.c_compare_zorder_xx[t.x<0?1:0]|ei.c_compare_zorder_yy[t.y<0?1:0],e=ei.c_compare_zorder_xx[s.x<0?1:0]|ei.c_compare_zorder_yy[s.y<0?1:0];if(i===e){let i=0,e=0;for(let n=0;n<2;++n){const r=Ks(t[n],s[n]);r>i&&(i=r,e=n)}return t[e]<s[e]}return i<e}static lerp(t,s,i){const e=new ei;return Y(t,s,i,e),e}static getClosestCoordinate(t,s,i,e=!1){const n=ei.getNAN();n.setSub(s,t);const r=n.sqrLength();if(0===r)return.5;if(s.isEqualPoint2D(i))return 1;const u=ei.getNAN();u.setSub(i,t);let h=u.dotProduct(n)/r;return e||(h<0?h=0:h>1&&(h=1)),h}static intersectLinesAtOnePoint(t,s,i,e){if(t.equals(s)||i.equals(e))return ei.getNAN();const n=s.x-t.x,r=i.x-e.x,u=s.y-t.y,h=i.y-e.y,a=n*h-r*u;if(!a)return ei.getNAN();const o=a;if(0===o)return ei.getNAN();let m=(i.x-t.x)*h-(i.y-t.y)*r;m/=o;const l=new ei;return Y(t,s,m,l),l.isFinite()?l:ei.getNAN()}toString(){return`[${this.x},${this.y}]`}}function ni(t,s,i){const e=new p(s.x);e.subThis(t.x);const n=new p(s.y);n.subThis(t.y);const r=new p(i.x);r.subThis(t.x);const u=new p(i.y);u.subThis(t.y);const h=e.clone();h.mulThisE(u);let a=n.clone();if(a.mulThisE(r),h.subThisE(a),0===h.value())return ei.getNAN();h.mulThis(2);const o=e.clone();o.mulThisE(e);const m=n.clone();m.mulThisE(n);const l=o.clone();l.addThisE(m);const c=r.clone();c.mulThisE(r);const f=u.clone();f.mulThisE(u);const _=c.clone();_.addThisE(f);const v=n.clone();v.mulThisE(_),a=u.clone(),a.mulThisE(l),v.subThisE(a),v.divThisE(h);const b=e.clone();b.mulThisE(_),a=r.clone(),a.mulThisE(l),b.subThisE(a),b.divThisE(h);const d=ei.construct(t.x-v.value(),t.y+b.value()),x=t.sub(d).length(),N=s.sub(d).length(),y=i.sub(d).length(),T=1e-15*(x+Math.abs(t.x)+Math.abs(s.x)+Math.abs(i.x)+Math.abs(t.y)+Math.abs(s.y)+Math.abs(i.y));return Math.abs(x-N)<=T&&Math.abs(x-y)<=T&&v.eps()<T&&b.eps()<T?d:ei.getNAN()}function ri(t,s,i){const e=Hs.constructDouble(s.x);e.subDoubleThis(t.x);const n=Hs.constructDouble(s.y);n.subDoubleThis(t.y);const r=Hs.constructDouble(i.x);r.subDoubleThis(t.x);const u=Hs.constructDouble(i.y);u.subDoubleThis(t.y);const h=e.clone();h.mulThis(u);let a=n.clone();if(a.mulThis(r),h.subThis(a),h.isZero())return ei.getNAN();h.mulDoubleThis(2);const o=e.clone();o.mulThis(e);const m=n.clone();m.mulThis(n);const l=o.clone();l.addThis(m);const c=r.clone();c.mulThis(r);const f=u.clone();f.mulThis(u);const _=c.clone();_.addThis(f);const v=n.clone();v.mulThis(_),a=u.clone(),a.mulThis(l),v.subThis(a),v.divThis(h);const b=e.clone();b.mulThis(_),a=r.clone(),a.mulThis(l),b.subThis(a),b.divThis(h);return ei.construct(t.x-v.value(),t.y+b.value())}ei.dimensions=2,ei.d=[[0,1,0,-1],[-1,0,1,0],[0,-1,0,1],[1,0,-1,0]],ei.c_compare_zorder_xx=[2,0],ei.c_compare_zorder_yy=[1,0];export{P as $,qs as A,yt as B,wt as C,Bs as D,x as E,p as F,w as G,I as H,us as I,Fs as J,n as K,St as L,Hs as M,Ss as N,Ot as O,ei as P,V as Q,U as R,Gt as S,pt as T,It as U,F as V,k as W,Dt as X,hs as Y,Y as Z,A as _,Tt as a,L as a0,O as a1,G as a2,rs as a3,Vt as a4,Gs as a5,Ys as a6,Vs as a7,Qs as a8,_t as a9,ti as aA,ii as aB,R as aC,Ms as aD,ms as aE,Kt as aF,Is as aG,Es as aH,vt as aa,jt as ab,Ct as ac,D as ad,Xs as ae,Ws as af,H as ag,Os as ah,ft as ai,st as aj,W as ak,js as al,At as am,Rs as an,cs as ao,gt as ap,gs as aq,ws as ar,Ft as as,Ps as at,Bt as au,S as av,Ts as aw,Ls as ax,qt as ay,si as az,Mt as b,ks as c,Lt as d,X as e,B as f,Cs as g,zt as h,ls as i,os as j,Ut as k,Yt as l,Rt as m,Qt as n,ct as o,kt as p,Q as q,as as r,$ as s,J as t,Pt as u,Et as v,Zt as w,j as x,z as y,C as z};
|